Babel不会植入corejs

时间:2019-05-17 03:50:38

标签: babeljs babel

我的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

enter image description here

0 个答案:

没有答案