在webpack4下用babel present 问题
来源:3-3 由浅入深 webpack - 编译 ES6
Jokky
2018-08-09
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.module has an unknown property 'exclude'. These properties are valid:
object { exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, noParse?, rules?, defaultRules?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp?, strictExportPresence?, strictThisContextOnImports? }
-> Options affecting the normal modules (`NormalModuleFactory`).
webpack.config.js
module.exports = {
entry: {
app: './app.js'
},
output: {
filename: '[name].[hash:8].js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: '/node_modules/',
use: {
loader: 'babel-loader'
}
}
]
}
1回答
-
qbaty
2018-08-09
我怀疑你是不是括号写错了?
configuration.module has an unknown property 'exclude'. 这个意思是webpack识别到你的 配置的module 里有一个未知的属性:exclude,你可以检查一下你的配置是否写错了,exclude 应该是在单独的rule 里
012018-08-09
相似问题