- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
使用webpack和watch时,比如使用webpack-dev-server
时似乎(至少)有两种不同的方法可以将文件排除在外。我真的找不到关于这两种配置之间差异以及它们为何不同的任何文档。有谁知道为什么?一种方法是首选吗?我应该打开一个问题和/或拉取请求来改进文档吗?
我最近遇到的第一次运行时多次触发 watch 的情况通过添加 watchIgnorePlugin
得到修复。并且未由 watchOptions.ignored
修复
webpack.WatchIgnorePlugin
Ignore the specified files, i.e. those matching the provided paths or regular expressions, while in watch mode.
new webpack.WatchIgnorePlugin(paths)
Options
- paths (array): A list of RegExps or absolute paths to directories or' files that should be ignored.
For some systems, watching many file systems can result in a lot of CPU or memory usage. It is possible to exclude a huge folder like
node_modules
:ignored: /node_modules/
It is also possible to use anymatch patterns:
ignored: "files/**/*.js"
最佳答案
WatchIgnorePlugin
-plugin 支持应忽略的目录或文件的正则表达式列表或绝对路径。watchOptions.ignored
-option 支持 anymatch -patterns,包括正则表达式、glob、字符串或将字符串作为参数并返回真值或假值的函数。
如果您在 Windows 上工作,这可能就是原因 watchOptions.ignored
不适合你:
Note: This module has Bash-parity, please be aware that Windows-style backslashes are not supported as separators. See https://github.com/micromatch/micromatch#backslashes for more information.
关于webpack - watchOptions.ignored 和 webpack.WatchIgnorePlugin 有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48361956/
使用webpack和watch时,比如使用webpack-dev-server时似乎(至少)有两种不同的方法可以将文件排除在外。我真的找不到关于这两种配置之间差异以及它们为何不同的任何文档。有谁知道为
我是一名优秀的程序员,十分优秀!