简体   繁体   中英

Unable to ignore folders in nuxtjs

I have a problem with nuxt ignore to exclude some folders from being watched especially during development. I have searched the inte.net and the solutions don't seem to work for me.

My .nuxtignore file

.idea/

And the ignore property in nuxt.config.js

ignore: [
  '**/*.test.*',
  'node_modules/*',
  '**/.idea/*',
  '**/.nuxt/*',
  '**/.*ignore',
],

I have also tried using the options independently, initially tried .idea/* in both files, still doesn't work, I get output like this in console:

↻ Updated .idea/workspace.xml                                                                                                                             16:36:04

✔ Client
  Compiled successfully in 7.20s

No issues found.

Is there anything am missing here?

This kind of configuration makes that the pages directory is not watched.

nuxt.config.js

export default {
  watchers: {
    webpack: {
      ignored: /(pages)/,
    },
  },
}

As mentioned here: https://github.com/nuxt/nuxt.js/issues/6326#issuecomment-1009037909

None of the other answers here worked for me. What finally did was adding an ignore array as per the docs to the nuxt.config.ts file. I was getting typescript errors when using some of the other solutions here.

For reference currently running Nuxi 3.0.0-rc.12
Nuxt 3.0.0-rc.12 with Nitro 0.6.1

// nuxt.config.ts:
...
ignore: [
  "path/to/ignore/**"
],
...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM