在 config-overrides.js 中有这段代码
const rewireReactHotLoader = require('react-app-rewire-hot-loader')
module.exports = function override(config, env) {
config = rewireReactHotLoader(config, env)
config.target = 'es2020'
config.resolve.alias = {
...config.resolve.alias,
'react-dom': '@hot-loader/react-dom',
hpscm: 'src/apps/hpscm',
lut: 'src/apps/lut/src/apps/lut',
shared: 'src/apps/lut/src/apps/shared',
search: 'src/apps/search/src/apps/search',
kbase: 'src/apps/kbase/src/apps/kbase',
docflow: 'src/apps/docflow/src/apps/docflow',
}
return config
}
得到这个错误:
Failed to compile.
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.target should be one of these:
"web" | "webworker" | "node" | "async-node" | "node-webkit" | "electron-main" | "electron-renderer" | "electron-preload" | function
-> Environment to build for
Details:
* configuration.target should be one of these:
"web" | "webworker" | "node" | "async-node" | "node-webkit" | "electron-main" | "electron-renderer" | "electron-preload"
* configuration.target should be an instance of function
还检查了这个问题 configuration.module 有一个未知的属性 'loaders'
我的配置中没有“加载程序”,只有“规则”。找不到任何解决方案。有人也遇到过这个问题吗?