Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/unplugin/unplugin-vue2

✨ Transform Vue 2.7+ SFC to JavaScript. Supports Vite, esbuild, Rollup and Webpack.
https://github.com/unplugin/unplugin-vue2

esbuild plugin rollup sfc unplugin vite vue-cli vuejs webpack

Last synced: 23 days ago
JSON representation

✨ Transform Vue 2.7+ SFC to JavaScript. Supports Vite, esbuild, Rollup and Webpack.

Awesome Lists containing this project

README

        

# unplugin-vue2

[![NPM version](https://img.shields.io/npm/v/unplugin-vue2?color=a1b858&label=)](https://www.npmjs.com/package/unplugin-vue2)

## 💎 Features

- ⚡️ Supports Vite, Webpack, Vue CLI, Rollup, esbuild and more, powered by unplugin.

## 📦 Installation

```bash
$ npm install unplugin-vue2 -D
$ yarn add unplugin-vue2 -D
$ pnpm add unplugin-vue2 -D
```

## 🚀 Usage

Vite

```ts
// vite.config.ts
import UnpluginVue2 from "unplugin-vue2/vite";

export default defineConfig({
plugins: [
UnpluginVue2({
/* options */
}),
],
});
```


Rollup

```ts
// rollup.config.js
import UnpluginVue2 from "unplugin-vue2/rollup";

export default {
plugins: [
UnpluginVue2({
/* options */
}),
// other plugins
],
};
```


Webpack

```ts
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require("unplugin-vue2/webpack")({
/* options */
}),
],
};
```


Vue CLI

```ts
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require("unplugin-vue2/webpack")({
/* options */
}),
],
},
};
```


Quasar

```ts
// quasar.conf.js [Vite]
module.exports = {
vitePlugins: [
[
"unplugin-vue2/vite",
{
/* options */
},
],
],
};
```

```ts
// quasar.conf.js [Webpack]
const UnpluginVue2Plugin = require("unplugin-vue2/webpack");

module.exports = {
build: {
chainWebpack(chain) {
chain.plugin("unplugin-vue2").use(
UnpluginVue2Plugin({
/* options */
}),
);
},
},
};
```


esbuild

```ts
// esbuild.config.js
import { build } from "esbuild";

build({
/* ... */
plugins: [
require("unplugin-vue2/esbuild")({
/* options */
}),
],
});
```


## 👍 Alternatives

- [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue) - For Vite and Vue 3.
- [@vitejs/plugin-vue2](https://github.com/vitejs/vite-plugin-vue2) - For Vite and Vue 2.
- ~~[vite-plugin-vue2](https://github.com/underfin/vite-plugin-vue2) - For Vite and Vue 2.~~
- ~~[rollup-plugin-vue](https://github.com/vuejs/rollup-plugin-vue)~~ - ⚠️ no longer maintained.
- [unplugin-vue](https://github.com/unplugin/unplugin-vue) - For Vue3.
- [vue-loader](https://github.com/vuejs/vue-loader) - For Webpack.
- [esbuild-plugin-vue](https://github.com/egoist/esbuild-plugin-vue) - For esbuild and Vue 3.
- [esbuild-vue](https://github.com/apeschar/esbuild-vue) - For esbuild and Vue 2.

## 📚 Credits

- [Vite](https://github.com/vitejs/vite) - Next generation frontend tooling. It's fast!
- [unplugin](https://github.com/unjs/unplugin) - Unified plugin system for Vite, Rollup, Webpack, and more

## 🙇‍ Thanks

Thanks to [Vite](https://github.com/vitejs/vite). This project is inherited from [@vitejs/[email protected]](https://github.com/vitejs/vite-plugin-vue2/tree/v2.2.0).
Thanks to [unplugin-vue](https://github.com/sxzz/unplugin-vue) for this idea (porting @vitejs/plugin-vue2 to unplugin).

## 📝 License

[MIT](./LICENSE). Made with ❤️ by [Ray](https://github.com/so1ve)