Use fervid Rust Compiler to Transform Vue 3 SFC to JavaScript
Due to the need to consider performance
and compatibility
issues, fervid
needs to refactor node
api. Please look forward to it.
Important
🚧 Working in Progress. May be break changes in the future. The final implementation goal should be consistent with the vue compiler behavior
Yes, it is incredibly fast. In fact, below is a benchmark run for a test component.
@vue/compiler-sfc:
954 ops/s, ±1.15% | slowest, 98.42% slower
@fervid/napi sync:
6 464 ops/s, ±0.08% | 89.29% slower
@fervid/napi async (4 threads):
11 624 ops/s, ±2.12% | 80.73% slower
@fervid/napi async CPUS (23 threads):
60 329 ops/s, ±0.67% | fastest
Note: results are for AMD Ryzen 9 7900X running on Fedora 38 with kernel version 6.5.9
Benchmarking in Node.js has been done using benny
, slightly modified to take libuv
threads into consideration.
Source code for a benchmark.
playground: Fervid Playground
Warning
this project is still being tested and not ready to apply it to production and only supports vue 3 for now.
Important
roadmap: Some features of this plugin roadmap represent the final fervid implementation of roadmap,View Fervid roadmap
- support hmr
- support css compile
- transform sfc assets url
- type options
- known bugs
- support other frameworks
Vite
// vite.config.ts
import Vue from 'unplugin-vue-fervid/vite'
export default defineConfig({
plugins: [
Vue({
/* options */
}),
],
})
- @vitejs/plugin-vue - For Vite and Vue 3.
- @vitejs/plugin-vue2 - For Vite and Vue 2.
- unplugin-vue2 - For Vue 2.7+ and Vite, esbuild, Rollup, Webpack or more.
- vue-loader - For Webpack.
- unplugin-vue - ✨ Transform Vue 3 SFC to JavaScript. Supports Vite, esbuild, Rollup, Webpack and more.
- esbuild-plugin-vue - For esbuild and Vue 3.
- esbuild-vue - For esbuild and Vue 2.
vite-plugin-vue2 - For Vite and Vue 2.rollup-plugin-vue-⚠️ no longer maintained.
- Vite - Next generation frontend tooling. It's fast!
- unplugin - Unified plugin system for Vite, Rollup, Webpack, and more
- unplugin-vue - ✨ Transform Vue 3 SFC to JavaScript. Supports Vite, esbuild, Rollup, Webpack and more.
- vite-plugin-vue - This project is inherited from it.