Webpack:未知参数:模式/配置具有未知属性“模式" [英] Webpack: Unknown argument: mode / configuration has an unknown property 'mode'
问题描述
被这个弄疯了,真的错过了什么......
getting crazy with this, really missing something....
我有 webpack 4.6.0,webpack-cli ^2.1.2,所以是最新的.
I have webpack 4.6.0, webpack-cli ^2.1.2, so the latest.
遵循文档(https://webpack.js.org/concepts/mode/),想使用必须配置的模式,一种用于生产,一种用于开发,但我得到:
Following the docs (https://webpack.js.org/concepts/mode/), want to use the mode to have to configs, one for production and one for development, but I get:
configuration[0] 有一个未知的属性mode".这些属性有效:对象{ amd?,保释?,缓存?,上下文?,依赖?,devServer?,devtool?,入口,外部?,加载器?,模块?,名称?,节点?,输出?,并行性?,性能?,插件?、profile?、recordsInputPath?、recordsOutputPath?、recordsPath?、resolve?、resolveLoader?、stats?、target?、watch?、watchOptions?}
configuration[0] has an unknown property 'mode'. These properties are valid: object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry, externals?, loader?, module?, name?, node?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }
我错过了什么:O?????
What am I missing :O?????
module.exports = [
merge(base, {
mode: 'development',
output: {
path: path.resolve(__dirname, './public/assets/development'),
},
}),
merge(base, {
mode: 'production',
output: {
path: path.resolve(__dirname, './public/assets/production'),
filename: '[name].bundle.js',
},
}),
]
推荐答案
好吧,问题是我全局安装了一个旧的 webpack,我想...
Ok, the problem was that I had an older webpack installed globally, I think...
这篇关于Webpack:未知参数:模式/配置具有未知属性“模式"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!