babel 配置
module.exports = function (api) {
api.cache(true);
return {
presets: [
[
"@babel/preset-env",
{
modules: false,
useBuiltIns: "entry", //entry usage
corejs: 3,
loose: true, //宽松模式 https://babeljs.io/docs/en/babel-preset-env#loose
targets: {
browsers: ["ie >= 8"],
},
},
],
],
plugins: [
/**
* @babel/plugin-transform-runtime
* 暂时不能使用 与@babel/plugin-transform-proto-to-assign组件不兼容 详情https://github.com/babel/babel/issues/11997
* @babel/plugin-transform-runtime 会自动引入regenerator 若使用当前插件需要把common.js里的 import 'regenerator-runtime/runtime'; 注释掉
*/
// ["@babel/plugin-transform-runtime", { helpers: false }],
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-modules-commonjs", // Cannot assign to read only property 'exports' of object '#<Object>'
"@babel/plugin-syntax-export-default-from",
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-transform-proto-to-assign", //https://babeljs.io/docs/en/caveats#classes-10-and-below fix IE<=10 静态属性不支持继承的bug 有问题的页面地址 http://localhost:8057/activity/intra
],
};
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32