简体   繁体   English

无法忽略nuxtjs中的文件夹

[英]Unable to ignore folders in nuxtjs

I have a problem with nuxt ignore to exclude some folders from being watched especially during development.我在使用nuxt ignore时遇到问题,无法将某些文件夹排除在监视范围之外,尤其是在开发过程中。 I have searched the inte.net and the solutions don't seem to work for me.我搜索了 inte.net,但解决方案似乎对我不起作用。

My .nuxtignore file我的.nuxtignore文件

.idea/

And the ignore property in nuxt.config.js以及nuxt.config.js中的 ignore 属性

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:我也尝试过独立使用这些选项,最初在两个文件中都尝试过.idea/* ,但仍然不起作用,我在控制台中得到这样的 output:

↻ 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.这种配置使得pages目录不被监视。

nuxt.config.js

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

As mentioned here: https://github.com/nuxt/nuxt.js/issues/6326#issuecomment-1009037909如此处所述: 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.最后所做的是根据文档向 nuxt.config.ts 文件添加一个ignore数组。 I was getting typescript errors when using some of the other solutions here.在此处使用其他一些解决方案时,我遇到了 typescript 错误。

For reference currently running Nuxi 3.0.0-rc.12供参考当前运行Nuxi 3.0.0-rc.12
Nuxt 3.0.0-rc.12 with Nitro 0.6.1 Nuxt 3.0.0-rc.12 与 Nitro 0.6.1

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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