Skip to content

antfu/nuxt-vite

 
 

Repository files navigation

v a c

🧪 Note: This is an experimental package and might be deprecated

What is working?

  • Using vite in development
  • Basic server-side rendering

Usage

Install package:

yarn add --dev nuxt-vite
# OR
npm i -D nuxt-vite

Add to buildModules:

// nuxt.config
export default {
  buildModules: [
    'nuxt-vite'
  ]
}

How it works

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

License

MIT - Nuxt Team

About

⚡ Vite Experience with Nuxt 2 🧪

Resources

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 93.9%
  • JavaScript 5.2%
  • Vue 0.9%