nuxt / vite
- воскресенье, 28 февраля 2021 г. в 00:27:59
⚡ Vite Experience with Nuxt 2 🧪
If found a bug, please report via issues with a minimal reproduction
Install package:
yarn add --dev nuxt-vite
# OR
npm i -D nuxt-vite
Add to buildModules
:
// nuxt.config
export default {
buildModules: [
'nuxt-vite'
]
}
Note: Nuxt >= 2.15.0 is required
Nuxt uses has a powerful hooking system to extend internals and abstracted bundler (@nuxt/webpack) which can be replaced. Vite module, replaces webpack by a similar interface to use vite instead of webpack. Client-side modules are loaded on demand using vite middleware.
Server-side bundle is being created by another vite instance and written to filesystem and passed using hooks to nuxt server-renderer.
Current approach is not most efficient due to usage of filesystem, extra build and lack of lazy loading.
Yet much faster than webpack builds. You can opt-out SSR build using nuxt dev --spa
This module could not be possible without vite-plugin-vue2 by @underfin
MIT - Nuxt Team