@ecoding/base.build 0.2.2 → 0.2.3
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { rootPath } = require("../../z-helpers/paths");
|
|
2
|
-
|
|
2
|
+
const { customConfig } = require("../../z-helpers/config");
|
|
3
3
|
const presets = [
|
|
4
4
|
[
|
|
5
5
|
"@babel/preset-env",
|
|
@@ -32,29 +32,26 @@ const presets = [
|
|
|
32
32
|
*/
|
|
33
33
|
useBuiltIns: "usage",
|
|
34
34
|
targets: {
|
|
35
|
-
browsers: [
|
|
36
|
-
"last 1 version",
|
|
37
|
-
"> 1%",
|
|
38
|
-
"IE 10",
|
|
39
|
-
"iOS >=6",
|
|
40
|
-
"Android >=4"
|
|
41
|
-
]
|
|
35
|
+
browsers: ["last 1 version", "> 1%", "IE 10", "iOS >=6", "Android >=4"]
|
|
42
36
|
},
|
|
43
37
|
// 如果设为true,则会编译 es6Module 语法,则会失去tree-shaking
|
|
44
38
|
modules: false,
|
|
45
|
-
corejs: 3,
|
|
39
|
+
corejs: customConfig.corejs || 3,
|
|
46
40
|
// 需要忽略的预编译包
|
|
47
41
|
exclude: [
|
|
48
42
|
// 没使用Symbol,不需要_typeof方法兼容Symbol
|
|
49
|
-
|
|
43
|
+
"transform-typeof-symbol"
|
|
50
44
|
]
|
|
51
45
|
}
|
|
52
46
|
],
|
|
53
|
-
[
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
[
|
|
48
|
+
"@babel/preset-react",
|
|
49
|
+
{
|
|
50
|
+
// automatic 自动模式 不需要引入 import React form 'react';
|
|
51
|
+
// classic 经典模式 需要引入 import React form 'react';
|
|
52
|
+
runtime: "classic"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
58
55
|
["@babel/preset-typescript"]
|
|
59
56
|
].filter(Boolean);
|
|
60
57
|
|
|
@@ -67,13 +64,13 @@ const plugins = [
|
|
|
67
64
|
].filter(Boolean);
|
|
68
65
|
|
|
69
66
|
const babelLoader = {
|
|
70
|
-
loader:
|
|
67
|
+
loader: "babel-loader",
|
|
71
68
|
options: {
|
|
72
69
|
presets,
|
|
73
70
|
plugins,
|
|
74
71
|
cacheDirectory: true
|
|
75
72
|
}
|
|
76
|
-
}
|
|
73
|
+
};
|
|
77
74
|
|
|
78
75
|
const getTsRule = () => {
|
|
79
76
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { rootPath } = require("../../z-helpers/paths");
|
|
2
|
-
|
|
2
|
+
const { customConfig } = require("../../z-helpers/config");
|
|
3
3
|
const presets = [
|
|
4
4
|
[
|
|
5
5
|
"@babel/preset-env",
|
|
@@ -34,19 +34,22 @@ const presets = [
|
|
|
34
34
|
targets: "node 14.0",
|
|
35
35
|
// 如果设为true,则会编译 es6Module 语法,则会失去tree-shaking
|
|
36
36
|
modules: false,
|
|
37
|
-
corejs: 3,
|
|
37
|
+
corejs: customConfig.corejs || 3,
|
|
38
38
|
// 需要忽略的预编译包
|
|
39
39
|
exclude: [
|
|
40
40
|
// 没使用Symbol,不需要_typeof方法兼容Symbol
|
|
41
|
-
|
|
41
|
+
"transform-typeof-symbol"
|
|
42
42
|
]
|
|
43
43
|
}
|
|
44
44
|
],
|
|
45
|
-
[
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
[
|
|
46
|
+
"@babel/preset-react",
|
|
47
|
+
{
|
|
48
|
+
// automatic 自动模式 不需要引入 import React form 'react'; 对应tsconfig.json jsx: react-jsx
|
|
49
|
+
// classic 经典模式 需要引入 import React form 'react'; 对应tsconfig.json jsx: react
|
|
50
|
+
runtime: "classic"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
50
53
|
["@babel/preset-typescript"]
|
|
51
54
|
].filter(Boolean);
|
|
52
55
|
|
|
@@ -59,13 +62,13 @@ const presets = [
|
|
|
59
62
|
// ].filter(Boolean);
|
|
60
63
|
|
|
61
64
|
const babelLoader = {
|
|
62
|
-
loader:
|
|
65
|
+
loader: "babel-loader",
|
|
63
66
|
options: {
|
|
64
67
|
presets,
|
|
65
68
|
// plugins,
|
|
66
69
|
cacheDirectory: true
|
|
67
70
|
}
|
|
68
|
-
}
|
|
71
|
+
};
|
|
69
72
|
|
|
70
73
|
const getTsRule = () => {
|
|
71
74
|
return {
|
package/libs/optimization/spa.js
CHANGED
|
@@ -29,7 +29,7 @@ const getOptimization = () => {
|
|
|
29
29
|
// 这里的体积大小时指压缩前的
|
|
30
30
|
obj.splitChunks = {
|
|
31
31
|
chunks: "all", // initial | all | async all 表明了在异步和同步之间共享
|
|
32
|
-
minSize:
|
|
32
|
+
minSize: 1500000, // 生成 chunk 的最小体积(以 bytes 为单位) 不限制,想要达到dll效果 这里是关键
|
|
33
33
|
maxSize: 2000000, // 封装的模块的最小体积 0 不限制
|
|
34
34
|
minRemainingSize: 10000, // 分割后剩下的模块大小 0 不限制
|
|
35
35
|
minChunks: 1, // 模块的最小被引用次数
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecoding/base.build",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "tpl building",
|
|
5
5
|
"author": "cxc",
|
|
6
6
|
"license": "MIT",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "adaea9603610921a2c9c356c9c0ca765320396eb"
|
|
55
55
|
}
|