3

I have a problem with nuxt ignore to exclude some folders from being watched especially during development. I have searched the internet 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?

raiyan22
  • 1,043
  • 10
  • 20
lulliezy
  • 1,741
  • 5
  • 24
  • 49
  • Hi, did you tried that one? https://github.com/nuxt/nuxt.js/issues/6326#issuecomment-1009037909 – kissu Oct 13 '22 at 07:30

2 Answers2

3

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

kissu
  • 40,416
  • 14
  • 65
  • 133
  • Hi, I had given up on this since none of the solutions worked until today when I checked this question again through notifications, this solution might actually work, I just implemented it and still testing to see if it will really work, once its all good, will mark this as accepted, and thanks btw – lulliezy Oct 16 '22 at 15:59
  • @lulliezy sounds perfect! Keep me updated if you have any success. – kissu Oct 16 '22 at 16:00
0

Note: my response below is for Nuxt3/vite so not specific to the original question, but sharing anyway as this was one of the results that came up in my search for trying to resolve the problem I had

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 answer was targeting Webpack (for Nuxt2 mostly), you're using Vite in your case so it's a different configuration indeed. Still, don't use an RC version, use the stable `v3.0` version. – kissu Jan 13 '23 at 00:57
  • 1
    Indeed, just haven't gotten around to the upgrade. Will be launching the site soon though so that'll be one of the housekeeping items to sort. Thanks – Chris Dermody Jan 13 '23 at 16:49
  • Ignore also targets builds, I don't think this is the same that the OP is asking for. – Nebulosar Mar 02 '23 at 13:57