我对 webpack 不是很了解,正在尝试将 webpack 从 V3 更新到 V4,并设法将我的 webpack 配置更新到不会向我抛出折旧错误的程度,但我现在陷入了 babel-loader 的语法错误:
Module build failed (from ./node_modules/babel-loader/lib/index.js):
/path/react/node_modules/schema-utils/dist/util/hints.js:16
const currentSchema = { ...schema
SyntaxError: Unexpected token ...
在我的 webpack 配置中,我有这个:
test: /\.(js|jsx)$/,
use: [
{
loader: 'babel-loader',
options: {
presets: [
'@babel/preset-env',
'@babel/preset-react',
{
plugins: [
'@babel/plugin-proposal-class-properties'
]
}
],
compact: true,
cacheDirectory: false, // @todo: legacy option: true
},
}
]
我正在使用以下版本:
"@babel/core": "^7.1.6",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/preset-env": "^7.1.6",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.4",
我曾多次尝试使用不同版本的 babel,但最终总是出现此消息。谁能看到我犯的任何明显错误吗?