@ecoding/base.build 0.1.11 → 0.2.1
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/README.md +4 -1
- package/libs/externals/index.js +8 -5
- package/libs/optimization/spa.js +2 -2
- package/libs/output/index.js +3 -2
- package/libs/plugins/index.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -9,15 +9,18 @@
|
|
|
9
9
|
mpa: boolean; // 是否是多页
|
|
10
10
|
dll:boolean; // 是否打dll
|
|
11
11
|
micro:"main" | "child"; // 微前端主应用或子应用 默认null
|
|
12
|
+
electron: boolean; // electron 是否是electron
|
|
12
13
|
outputLibrary: string; // micro == child时生效,整个库向外暴露的变量名
|
|
13
14
|
publicPath: string; // client cdn 资源前缀
|
|
14
15
|
outputPath: string; // client build bundle 目录,相对命令执行目录
|
|
15
16
|
runtimeChunk: bool; // 是否在html里内联webpack-runtime
|
|
17
|
+
noClear: bool; // 是否使用 CleanWebpackPlugin, 默认false
|
|
16
18
|
externals: object;
|
|
17
19
|
/* externals
|
|
18
20
|
{
|
|
19
21
|
"@alilc/lowcode-engine": "var window.AliLowCodeEngine",
|
|
20
22
|
"@alilc/lowcode-engine-ext": "var window.AliLowCodeEngineExt",
|
|
23
|
+
"electron": true,
|
|
21
24
|
};
|
|
22
25
|
*/
|
|
23
26
|
dev:{
|
|
@@ -74,7 +77,7 @@ module.exports = {
|
|
|
74
77
|
"babel-eslint": "10.1.0",
|
|
75
78
|
"babel-loader": "8.2.5",
|
|
76
79
|
"clean-webpack-plugin": "^4.0.0",
|
|
77
|
-
"concurrently": "^7.3.0",
|
|
80
|
+
"concurrently": "^7.3.0", // 并行执行node 命令
|
|
78
81
|
"core-js": "3.23.1",
|
|
79
82
|
"cross-env": "7.0.3",
|
|
80
83
|
"css-loader": "6.7.1",
|
package/libs/externals/index.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
const { customConfig } = require("../z-helpers/config");
|
|
2
2
|
|
|
3
3
|
const getExternals = () => {
|
|
4
|
-
return
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
return Object.assign(
|
|
5
|
+
{
|
|
6
|
+
// "@alilc/lowcode-engine": "var window.AliLowCodeEngine",
|
|
7
|
+
// "@alilc/lowcode-engine-ext": "var window.AliLowCodeEngineExt",
|
|
8
|
+
...customConfig.externals
|
|
9
|
+
},
|
|
10
|
+
customConfig.electron ? { electron: true } : {}
|
|
11
|
+
);
|
|
9
12
|
};
|
|
10
13
|
|
|
11
14
|
module.exports = getExternals;
|
package/libs/optimization/spa.js
CHANGED
|
@@ -29,8 +29,8 @@ const getOptimization = () => {
|
|
|
29
29
|
// 这里的体积大小时指压缩前的
|
|
30
30
|
obj.splitChunks = {
|
|
31
31
|
chunks: "all", // initial | all | async all 表明了在异步和同步之间共享
|
|
32
|
-
minSize:
|
|
33
|
-
maxSize:
|
|
32
|
+
minSize: 1000000, // 生成 chunk 的最小体积(以 bytes 为单位) 不限制,想要达到dll效果 这里是关键
|
|
33
|
+
maxSize: 2000000, // 封装的模块的最小体积 0 不限制
|
|
34
34
|
minRemainingSize: 10000, // 分割后剩下的模块大小 0 不限制
|
|
35
35
|
minChunks: 1, // 模块的最小被引用次数
|
|
36
36
|
maxAsyncRequests: 30, // 异步模块按需加载的最大并行请求数 import('xxx.js').then
|
package/libs/output/index.js
CHANGED
|
@@ -38,7 +38,7 @@ const getOutput = () => {
|
|
|
38
38
|
// library: '[name]', // 整个库向外暴露的变量名
|
|
39
39
|
// libraryTarget: 'var' // 默认
|
|
40
40
|
},
|
|
41
|
-
customConfig.micro === "child"
|
|
41
|
+
!customConfig.electron && customConfig.micro === "child"
|
|
42
42
|
? {
|
|
43
43
|
library: {
|
|
44
44
|
name: customConfig.outputLibrary,
|
|
@@ -47,7 +47,8 @@ const getOutput = () => {
|
|
|
47
47
|
chunkLoadingGlobal: `webpackJsonp_${customConfig.outputLibrary}`,
|
|
48
48
|
globalObject: "window"
|
|
49
49
|
}
|
|
50
|
-
: {}
|
|
50
|
+
: {},
|
|
51
|
+
customConfig.electron ? { libraryTarget: "commonjs2" } : {}
|
|
51
52
|
);
|
|
52
53
|
};
|
|
53
54
|
|
package/libs/plugins/index.js
CHANGED
|
@@ -105,7 +105,7 @@ module.exports = () => {
|
|
|
105
105
|
// 内联runtime
|
|
106
106
|
customConfig.runtimeChunk && customConfig.micro !== "child" && new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/wp-runtime-.*\.js/]),
|
|
107
107
|
|
|
108
|
-
new CleanWebpackPlugin(),
|
|
108
|
+
!customConfig.noClear && new CleanWebpackPlugin(),
|
|
109
109
|
|
|
110
110
|
// 告诉webpack哪些库不参与打包,同时使用时的名称也得变
|
|
111
111
|
customConfig.dll &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecoding/base.build",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "tpl building",
|
|
5
5
|
"author": "cxc",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"rimraf": "^3.0.2",
|
|
40
40
|
"style-loader": "3.3.1",
|
|
41
41
|
"terser-webpack-plugin": "5.3.3",
|
|
42
|
-
"typescript": "4.8.
|
|
42
|
+
"typescript": "^4.8.4",
|
|
43
43
|
"webpack": "5.73.0",
|
|
44
44
|
"webpack-cli": "4.10.0",
|
|
45
45
|
"webpack-dev-server": "4.9.2",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "98edfa407d94f9358bc7d1275634bcb0d79a0c01"
|
|
54
54
|
}
|