webpack - 我怎样才能让 babel 做 ie 与 core-js 的兼容性
问题描述
我有这个 webpack 代码
...
rules: [
{
test: /(\.m?js?$)|(\.svelte$)/,
exclude: /\bcore-js\b/,
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', {
targets: {
'ie':'11'
},
useBuiltIns: "usage",
corejs: 3
}]
],
plugins: [
// '@babel/plugin-proposal-class-properties',
// '@babel/plugin-transform-shorthand-properties'
],
sourceType: 'unambiguous'
}
}
},
{
test: /\.svelte$/,
exclude: /node_modules/,
use: {
loader: 'svelte-loader',
options: {
//emitCss: true,
hotReload: true
}
}
},
...
它适用于 chrome 等,但在 IE 中我收到此错误SCRIPT5002: Function expected in es.symbol.js
我不太明白为什么会这样或如何解决它,我认为 core-js 会解决这个问题?
解决方案
推荐阅读
- dataset - chart.js - 堆叠的水平条数据集组织帮助请求
- php - 如何在 PHP 中使用 Cronjob 触发 URL?
- android - 图像不会随通话而改变
- angular - 角12 | 导航到不同组件后如何更新全局页眉/页脚的全部内容
- python - PyTorch Transformer: ValueError: Expected target size (2, 256), gottorch.Size([2, 8, 256])
- typescript - 承诺链 - 等待长时间运行
- python - 如何从 1 个独立列预测多个依赖列
- css - 使用 by,linktext 时无法定位元素
- wordpress - 我如何将 codestar 框架与 WordPress 主题集成?
- flutter - 推后如何在脚手架树中弹出抽屉