2 回答
TA贡献1798条经验 获得超7个赞
尝试在 babel.config 中添加插件.js
module.exports = {
presets: [['@babel/preset-env', { modules: false }]],
plugins: [
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-arrow-functions' // add this
],
env: {
test: {
presets: [['@babel/preset-env']]
}
}
}
TA贡献1895条经验 获得超3个赞
如果您使用的是 Webpack 5,则需要在配置中指定要转译的功能部件,如下所述:https://webpack.js.org/configuration/output/#outputenvironment。ouput.environment
output: {
// ... other configs
environment: {
arrowFunction: false,
bigIntLiteral: false,
const: false,
destructuring: false,
dynamicImport: false,
forOf: false,
module: false,
},
}
添加回答
举报