esbuild-plugin-vue provides basic support for processing Vue 3 Single File Components (SFCs) directly within esbuild build pipelines. It enables core features like `<script setup>` syntax, TypeScript integration within script blocks, and scoped CSS styles, allowing developers to leverage esbuild's speed for compiling Vue applications. As of version 0.2.4, it is considered pre-1.0, indicating ongoing development and potential for API changes without strictly adhering to semantic versioning until a 1.x release. The plugin differentiates itself by offering a lightweight, esbuild-native solution for Vue SFC compilation, aiming for simplicity and performance over the more extensive feature sets of dedicated Vue build tools like Vite or Vue CLI. It utilizes `@vue/compiler-sfc` under the hood to perform the actual Vue compilation. The package appears to be actively maintained, evidenced by recent updates and a call for sponsorship.
npm install esbuild-plugin-vueVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to integrate `esbuild-plugin-vue` into an esbuild configuration to compile a basic Vue 3 SFC with `<script setup>`, TypeScript, and scoped styles.
Always test new versions in a development environment before deploying to production. Monitor the package's GitHub repository for pre-release announcements or breaking change notes.
Ensure your `esbuild` version precisely matches the peer dependency range. Use `npm install esbuild@<version>` or `yarn add esbuild@<version>` to pin to a compatible version if necessary.
For complex Vue applications, evaluate if this plugin meets all requirements. Be prepared to implement custom esbuild plugins or fallback to official Vue tooling if advanced features are missing or problematic.
Install the missing peer dependency: `npm install @vue/compiler-sfc` or `yarn add @vue/compiler-sfc`.
Install `esbuild` to a compatible version: `npm install esbuild@"^0.x.y"` (replacing `x.y` with a version within the plugin's specified range `">=0.11 <=1"`).
Change your import statement from `import { vue } from 'esbuild-plugin-vue'` to `import vue from 'esbuild-plugin-vue'`.