我正在学习这个教程: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']
}
}
]
}
}
有人知道我的代码出了什么问题吗?