Skip to content

Latest commit

 

History

History
92 lines (68 loc) · 3.6 KB

README.md

File metadata and controls

92 lines (68 loc) · 3.6 KB

unplugin-vue-fervid

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

Is it fast?

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.

Configuration

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 */
    }),
  ],
})


Alternatives

Thanks

  • 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.