Vite: how to specify the folders need to be watched

Viewed 1678

I am using Vite in my SSR Nuxt project by nuxt-vite

But the folder structure of my Nuxt project is not a default one but a custom one like this:

enter image description here

the Nuxt project is inside of a Laravel project (I referenced this project)

Once I run npm run dev with vite: {ssr: true}, because the package.json is located at the root dir but the Nuxt project is not, Vite will watch all the changes in the folders under root dir.


I try to specify the folders that Vite need to watch

accroding to the vite-document and rollupjs document

my nuxt.config.js is

vite: {
  ssr: true,
  build: {
    watch: {
      include: 'client/**',
      // or this
      exclude: [
        '.git',
        '.nuxt',
        'app',
        'bootstrap',
        'config',
        'database',
        'node_modules',
        'public',
        'resources',
        'routes',
        'storage',
        'tests',
        'vendor'
      ]
    }
  }
},

but the error is as same as it before: the Vite still watch all the folders under root dir

enter image description here


How can I config the Vite so the folders can be watched correctly?

0 Answers
Related