【发布时间】:2021-10-29 05:15:21
【问题描述】:
我正在关注本教程:https://www.youtube.com/watch?v=iWUR04B42Hc,我知道它的内容已过时,但我认为已将其正确翻译成 Webpack 的较新版本,但出现此错误:configuration.module.rules[0] has an unknown property 'query'.
完全错误:
[webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.module.rules[0] has an unknown property 'query'. These properties are valid:
object { assert?, compiler?, dependency?, descriptionData?, enforce?, exclude?, generator?, include?, issuer?, issuerLayer?, layer?, loader?, mimetype?, oneOf?, options?, parser?, realResource?, resolve?, resource?, resourceFragment?, resourceQuery?, rules?, scheme?, sideEffects?, test?, type?, use? }
-> A rule description with conditions and effects for modules.
我的 webpack.config.js
const path = require('path');
module.exports = {
entry: {
app: './source/app.js'
},
output: {
path: path.resolve(__dirname, 'build'),
filename: 'app.bundle.js'
},
mode: 'development',
module: {
rules: [
{
test: /\.js?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['@babel/preset-env']
}
}
]
}
}
你知道我的代码有什么问题吗?
【问题讨论】:
标签: javascript webpack ecmascript-6 babeljs ecmascript-5