@umijs/babel-preset-umi 4.0.0-rc.13 → 4.0.0-rc.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +35 -12
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -13,27 +13,45 @@ exports.default = (_context, opts) => {
|
|
|
13
13
|
presets: [
|
|
14
14
|
[
|
|
15
15
|
require.resolve('@umijs/bundler-utils/compiled/babel/preset-env'),
|
|
16
|
-
|
|
16
|
+
{
|
|
17
|
+
bugfixes: true,
|
|
17
18
|
// 更兼容 spec,但会变慢,所以不开
|
|
18
|
-
spec: false,
|
|
19
|
+
spec: false,
|
|
19
20
|
// 推荐用 top level 的 assumptions 配置
|
|
20
|
-
loose: false,
|
|
21
|
+
loose: false,
|
|
21
22
|
// 保留 es modules 语法,交给 webpack 处理
|
|
22
|
-
modules: false,
|
|
23
|
+
modules: false,
|
|
24
|
+
debug: false,
|
|
25
|
+
useBuiltIns: 'entry',
|
|
26
|
+
corejs: (0, utils_1.getCorejsVersion)((0, path_1.join)(__dirname, '../package.json')),
|
|
23
27
|
// 没必要,遇到了应该改 targets 配置
|
|
24
|
-
forceAllTransforms: false,
|
|
28
|
+
forceAllTransforms: false,
|
|
29
|
+
ignoreBrowserslistConfig: true,
|
|
30
|
+
...opts.presetEnv,
|
|
31
|
+
},
|
|
25
32
|
],
|
|
26
33
|
[
|
|
27
34
|
require.resolve('@umijs/bundler-utils/compiled/babel/preset-react'),
|
|
28
|
-
|
|
35
|
+
{
|
|
36
|
+
runtime: 'automatic',
|
|
37
|
+
development: process.env.NODE_ENV === 'development',
|
|
38
|
+
importSource: 'react',
|
|
39
|
+
...opts.presetReact,
|
|
40
|
+
},
|
|
29
41
|
],
|
|
30
42
|
[
|
|
31
43
|
require.resolve('@umijs/bundler-utils/compiled/babel/preset-typescript'),
|
|
32
|
-
|
|
44
|
+
{
|
|
33
45
|
// 支持vue 后缀
|
|
34
|
-
allExtensions: true,
|
|
46
|
+
allExtensions: true,
|
|
35
47
|
// 支持tsx
|
|
36
|
-
isTSX: true,
|
|
48
|
+
isTSX: true,
|
|
49
|
+
allowNamespaces: true,
|
|
50
|
+
allowDeclareFields: true,
|
|
51
|
+
onlyRemoveTypeImports: true,
|
|
52
|
+
optimizeConstEnums: true,
|
|
53
|
+
...opts.presetTypeScript,
|
|
54
|
+
},
|
|
37
55
|
],
|
|
38
56
|
],
|
|
39
57
|
plugins: [
|
|
@@ -82,14 +100,19 @@ exports.default = (_context, opts) => {
|
|
|
82
100
|
],
|
|
83
101
|
opts.pluginTransformRuntime && [
|
|
84
102
|
require.resolve('@umijs/bundler-utils/compiled/babel/plugin-transform-runtime'),
|
|
85
|
-
|
|
103
|
+
{
|
|
104
|
+
helpers: true,
|
|
105
|
+
regenerator: true,
|
|
86
106
|
// 7.13 之后根据 exports 自动选择 esm 和 cjs,无需此配置
|
|
87
|
-
useESModules: false,
|
|
107
|
+
useESModules: false,
|
|
88
108
|
// lock the version of @babel/runtime
|
|
89
109
|
// make sure we are using the correct version
|
|
90
110
|
// ref: https://github.com/babel/babel/blob/v7.16.12/packages/babel-plugin-transform-runtime/src/get-runtime-path/index.ts#L19
|
|
91
111
|
// ref: https://github.com/umijs/umi/pull/7816
|
|
92
|
-
absoluteRuntime: (0, path_1.dirname)(require.resolve('../package.json')),
|
|
112
|
+
absoluteRuntime: (0, path_1.dirname)(require.resolve('../package.json')),
|
|
113
|
+
version: `^${require('@babel/runtime/package.json').version}`,
|
|
114
|
+
...opts.pluginTransformRuntime,
|
|
115
|
+
},
|
|
93
116
|
],
|
|
94
117
|
// none official plugins
|
|
95
118
|
opts.pluginLockCoreJS && [lockCoreJS_1.default],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/babel-preset-umi",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.16",
|
|
4
4
|
"description": "Official babel preset for umi.",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/babel-preset-umi#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "pnpm tsc",
|
|
19
|
-
"build:deps": "
|
|
19
|
+
"build:deps": "umi-scripts bundleDeps",
|
|
20
20
|
"dev": "pnpm build -- --watch",
|
|
21
|
-
"test": "
|
|
21
|
+
"test": "umi-scripts jest-turbo"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@babel/runtime": "7.17.9",
|
|
25
25
|
"@bloomberg/record-tuple-polyfill": "0.0.4",
|
|
26
|
-
"@umijs/bundler-utils": "4.0.0-rc.
|
|
27
|
-
"@umijs/utils": "4.0.0-rc.
|
|
28
|
-
"core-js": "3.
|
|
26
|
+
"@umijs/bundler-utils": "4.0.0-rc.16",
|
|
27
|
+
"@umijs/utils": "4.0.0-rc.16",
|
|
28
|
+
"core-js": "3.22.4"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|