【发布时间】:2023-01-28 05:06:44
【问题描述】:
我是少校菜鸟在编写代码时,我正致力于使用 ruby on rails 和 react redux 创建网站克隆。
我目前遇到这个问题:
[webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.module.rules[0].use has an unknown property 'query'. These properties are valid:
object { ident?, loader?, options? }.
这是我的 webpack.config.js:
const path = require('path');
module.exports = {
context: __dirname,
entry: './frontend/clone.jsx',
output: {
path: path.resolve(__dirname, 'app', 'assets', 'javascripts'),
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
query: {
presets: ['@babel/env', '@babel/react']
}
},
}
]
},
devtool: 'source-map',
resolve: {
extensions: [".js", ".jsx", "*"]
}
};
【问题讨论】:
-
尝试用
options替换query -
泰。这有效
标签: webpack babel-loader