相关疑难解决方法(0)

Webpack 5:devtool ValidationError,无效的配置对象

从 Webpack 4 迁移到 Webpack 5 时,使用devtool空值时出现错误(仅在生产模式下)。

module.exports = {
    devtool: isProd ? '' : 'source-map',
    // entry: ...
    // output: ...
    // module: ...
}
Run Code Online (Sandbox Code Playgroud)

控制台中的消息:

ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
 - configuration.devtool should match pattern "^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map$".
   BREAKING CHANGE since webpack 5: The devtool option is more strict.
   Please strictly follow the order of the keywords in the pattern.
Run Code Online (Sandbox Code Playgroud)

任何想法如何在生产模式下避免源映射?在那里输入什么?

webpack webpack-5

16
推荐指数
1
解决办法
1万
查看次数

标签 统计

webpack ×1

webpack-5 ×1