I'll trying to use uglify with webpack but got this error:
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration has an unknown property 'optimization'. These properties are valid:
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry, externals?, loader?, module?, name?, node?, output?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }
Run Code Online (Sandbox Code Playgroud)
I have
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
Run Code Online (Sandbox Code Playgroud)
and
optimization: {
minimizer: [new UglifyJsPlugin()]
}
Run Code Online (Sandbox Code Playgroud)
在我的webpack.config.js中,看起来webpack无法识别“优化”?
也许您使用的是旧版的webpack版本(3?),并且可能需要将插件实例放在plugin属性中:
module.exports = {
...
plugins: [new UglifyJSPlugin()]
};
Run Code Online (Sandbox Code Playgroud)
始终尝试查找与您使用的版本匹配的文档,或者将webpack更新为较新的版本。当前版本为4.19.0(于2018-09-17)。
| 归档时间: |
|
| 查看次数: |
2798 次 |
| 最近记录: |