webpack配置babel问题?

rules: [{
            test: /\.jsx?$/,
            loader: 'babel-loader',
            include: [
                path.resolve(__dirname, 'src'),
                /node_modules[\\/]scratch-[^\\/]+[\\/]src/,
                /node_modules[\\/]pify/,
                /node_modules[\\/]@vernier[\\/]godirect/
            ],
            options: {
                // Explicitly disable babelrc so we don't catch various config
                // in much lower dependencies.
                babelrc: true,
                plugins: [
                    '@babel/plugin-syntax-dynamic-import',
                    // '@babel/plugin-transform-async-to-generator',
                    // '@babel/plugin-proposal-object-rest-spread',
                    ['react-intl', {
                        messagesDir: './translations/messages/'
                    }]],
                presets: [
                    [
                        "@babel/preset-env",
                        {
                            "targets": {
                              "chrome": "58",
                              "android": "6.0"
                            }
                        }
                    ],
                    "@babel/preset-react",
                ],
            }
        },

兄弟们我的targets写了两个参数就报错,我只留一个"chrome": "58"就能通,报的错是regeneratorRuntime is not defined,请我该如何修改

阅读 1.7k
2 个回答
{
  "plugins": [
    [
      "@babel/plugin-transform-runtime"
    ]
  ]
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏