Vite is a modern frontend build tool that provides an extremely fast development environment and bundles your code for production. It will change your development experience with super fast hot reloading 🚅.
But there is an issue with nuxt 2.15.8 in integration. You will get an error called - Cannot find module 'lib/axios'
So fix that, let's start from begging I mean from installation part-
To install vite with simple command
npm i -D nuxt-vite
Add to buildModules in nuxt.config.js
buildModules: [
'nuxt-vite'
],
And now you will get this error Cannot find module 'lib/axios'
. This problem comes from vite version. Let's downgrade, then our error will be gone.
In package.json
file downgrade vite version "nuxt-vite: 0.3.5"
to "nuxt-vite": "^0.2.4"
Then again install all dependencies by
npm install
Now you can run npm run dev
and enjoy vite
blessing fast speed.
If you are in 1st place I mean you are going to install vite
you can install specific version by
npm install nuxt-vite@0.2.4
Top comments (2)
Damn, never knew you could use Nuxt2 with Vite!
Meanwhile, it looks like this module is actually deprecated: github.com/nuxt/vite
Not sure that it's the best to use such package so. 😅
This package is actually deprecated 😂