Registry / devops / vite-plugin-makefile

vite-plugin-makefile

JSON →
library0.0.5jsnpmunverified

Vite plugin that converts Makefile .PHONY targets into vite-plus tasks. Version 0.0.5 is the latest stable release. It automatically discovers Makefiles in specified directories, maps prerequisites to task dependencies, and supports prefix strategies for task names. Built on makefile-lossless via NAPI-RS for efficient parsing. Key differentiator: integrates Makefile targets directly into the vite-plus build system, eliminating the need to manually duplicate tasks. Compared to alternatives like just or taskfile, it reuses existing Makefiles without extra configuration. Limitations: only supports .PHONY targets, no variable expansion, pattern rules, or recursive make. Ideal for projects already using Makefiles that want to leverage vite-plus task execution.

npm install vite-plugin-makefile
INSTALL
IMPORT
SIG · VITE-PLUGIN-MAKEFI
V
vite-plugin-makefile
devopsjavascriptv0.0.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Makefile
import { Makefile } from 'vite-plugin-makefile'
const { Makefile } = require('vite-plugin-makefile')
Named export only; default export not available. The plugin is ESM-only; require() will not work.

Configures vite-plugin-makefile in a vite-plus project, scanning current and infra directories, excluding 'help' and 'default' targets, and using directory prefix for generated tasks.

import { defineConfig } from 'vite-plus'; import { Makefile } from 'vite-plugin-makefile'; export default defineConfig({ plugins: [ Makefile({ include: ['.', 'infra'], exclude: ['help', 'default'], prefix: 'directory' }) ], run: { tasks: { lint: { command: 'vp lint' } } } });
Debug
Known issues
gotchaOnly .PHONY targets are converted to tasks. Non-phony targets (file targets) are ignored silently.
fix
Ensure all desired targets are declared as .PHONY in your Makefile.
affects: >=0.0.0
gotchaVariable expansion ($(VAR)), pattern rules (%.o: %.c), and recursive Make invocations are not supported. These are silently skipped or may cause incorrect behavior.
fix
Avoid using these features in Makefiles intended for plugin use. Use the include option to manage subdirectories instead of recursive Make.
affects: >=0.0.0
gotchaConditional targets (ifeq / ifdef) are not supported. The plugin may misparse or ignore them.
fix
Simplify Makefiles to avoid conditionals in .PHONY targets.
affects: >=0.0.0
gotchaIf prefix strategy is 'none' and two different directories produce the same target name, the plugin will throw an error to avoid name conflicts.
fix
Use 'directory' prefix or a custom function to disambiguate task names.
affects: >=0.0.0
gotchaThe plugin relies on a NAPI-RS binding for makefile-lossless. This requires a compatible Node.js version and platform. On unsupported platforms, the plugin may fail to load.
fix
Ensure your system meets the native dependency requirements (see napi-rs docs).
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'vite-plugin-makefile'
The package is not installed or is installed but not found in node_modules.
fix
Run 'npm install vite-plugin-makefile' or 'vp add -D vite-plugin-makefile'.
TypeError: Makefile is not a function
Importing the wrong export or using require() when the package is ESM-only.
fix
Use 'import { Makefile } from 'vite-plugin-makefile'' instead of CommonJS require().
Error: Prefix strategy 'none' caused duplicate task name 'build'
Two Makefiles in different directories both define a .PHONY target named 'build'.
fix
Change prefix to 'directory' or provide a custom naming function to avoid conflicts.
Upgrade
Version history
0.0.5latest on npm
Audit
Dependencies
vite-plusrequiredThe plugin generates tasks for vite-plus; it cannot be used without vite-plus as the build system.
Agent activity
2 hits · last 30 days
node
2
Resources
vite-plugin-makefile — npm install vite-plugin-makefile · libregistry