我正在尝试使用镜像加载器中的bypassOnDebug
选项,这意味着我需要将webpack置于“调试模式”(根据镜像加载器文档)。
在使用开发服务器时会自动进入调试模式,还是需要在webpack配置中指定?
如果我需要指定它,你能提供一个代码样本吗?
发布于 2017-01-21 20:27:42
Webpack 2& 3
顶级配置上的debug
属性不仅已被弃用,而且是无效的。
相反,您必须在每个加载器级别上配置它,正如在使用现在无效的debug
顶级属性集运行时显示的令人难以置信的友好错误消息所描述的那样:
The 'debug' property was removed in webpack 2.
Loaders should be updated to allow passing this option
via loader options in module.rules.
Until loaders are updated one can use the LoaderOptionsPlugin
to switch loaders into debug mode:
plugins: [
new webpack.LoaderOptionsPlugin({
debug: true
})
]
The docs also have similar information.
备注
我发现将我所有的加载器更新到最新版本,然后逐个尝试它们,看看它们是否接受debug
选项,这有点重量级,因为我只想根据配置将它们全部设置为真或全部为假。
如果这是您的情况,我可以确认使用webpack.LoaderOptionsPlugin
是最简单的方法。无论是新旧的装载机,它都能工作。
https://stackoverflow.com/questions/34142643
复制相似问题