{"id":26593,"library":"vite-plugin-makefile","title":"vite-plugin-makefile","description":"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.","status":"active","version":"0.0.5","language":"javascript","source_language":"en","source_url":"https://github.com/kazupon/vite-plugin-makefile","tags":["javascript","makefile","plugin","task-runner","vite","vite-plus"],"install":[{"cmd":"npm install vite-plugin-makefile","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-makefile","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-makefile","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"The plugin generates tasks for vite-plus; it cannot be used without vite-plus as the build system.","package":"vite-plus","optional":false}],"imports":[{"note":"Named export only; default export not available. The plugin is ESM-only; require() will not work.","wrong":"const { Makefile } = require('vite-plugin-makefile')","symbol":"Makefile","correct":"import { Makefile } from 'vite-plugin-makefile'"}],"quickstart":{"code":"import { defineConfig } from 'vite-plus';\nimport { Makefile } from 'vite-plugin-makefile';\n\nexport default defineConfig({\n  plugins: [\n    Makefile({\n      include: ['.', 'infra'],\n      exclude: ['help', 'default'],\n      prefix: 'directory'\n    })\n  ],\n  run: {\n    tasks: {\n      lint: { command: 'vp lint' }\n    }\n  }\n});","lang":"typescript","description":"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."},"warnings":[{"fix":"Ensure all desired targets are declared as .PHONY in your Makefile.","message":"Only .PHONY targets are converted to tasks. Non-phony targets (file targets) are ignored silently.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Avoid using these features in Makefiles intended for plugin use. Use the include option to manage subdirectories instead of recursive Make.","message":"Variable expansion ($(VAR)), pattern rules (%.o: %.c), and recursive Make invocations are not supported. These are silently skipped or may cause incorrect behavior.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Simplify Makefiles to avoid conditionals in .PHONY targets.","message":"Conditional targets (ifeq / ifdef) are not supported. The plugin may misparse or ignore them.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use 'directory' prefix or a custom function to disambiguate task names.","message":"If prefix strategy is 'none' and two different directories produce the same target name, the plugin will throw an error to avoid name conflicts.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Ensure your system meets the native dependency requirements (see napi-rs docs).","message":"The 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.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'npm install vite-plugin-makefile' or 'vp add -D vite-plugin-makefile'.","cause":"The package is not installed or is installed but not found in node_modules.","error":"Error: Cannot find module 'vite-plugin-makefile'"},{"fix":"Use 'import { Makefile } from 'vite-plugin-makefile'' instead of CommonJS require().","cause":"Importing the wrong export or using require() when the package is ESM-only.","error":"TypeError: Makefile is not a function"},{"fix":"Change prefix to 'directory' or provide a custom naming function to avoid conflicts.","cause":"Two Makefiles in different directories both define a .PHONY target named 'build'.","error":"Error: Prefix strategy 'none' caused duplicate task name 'build'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}