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,
},
}
添加回答
舉報