我的babel配置:
module.exports = {
presets: [
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"forceAllTransforms": true,
"targets": {
"browsers": ["last 12 version"]
},
"ignoreBrowserslistConfig": false,
"debug": false
}
]
],
plugins: [
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-transform-destructuring",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-proposal-class-properties",
["@babel/plugin-transform-runtime", {
"corejs": 2,
}],
["@babel/plugin-transform-modules-commonjs", {
"allowTopLevelThis": true,
"helpers": true,
"useESModules": false,
}],
[
"component",
{
"libraryName": "element-ui",
"styleLibraryName": "theme-chalk"
}
]
]
}
错误:ReferenceError: require is not defined