@ecoding/base.build 0.1.5 → 0.1.7

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.
@@ -3,12 +3,11 @@ const nodeExternals = require("webpack-node-externals");
3
3
 
4
4
  // https://www.tangshuang.net/3343.html 详解 https://sokpim.yuque.com/sokpim/uwbz2i/rfritg
5
5
  const getExternals = () => {
6
- return [
7
- // { "@alilc/lowcode-engine": "var window.AliLowCodeEngine" },
8
- // { "@alilc/lowcode-engine-ext": "var window.AliLowCodeEngineExt" },
9
- // nodeExternals(),
10
- customConfig.ssr.externals
11
- ]
6
+ let ary = [];
7
+ if (customConfig.ssr && customConfig.ssr.externals) {
8
+ ary = customConfig.ssr.externals
9
+ }
10
+ return ary;
12
11
  };
13
12
 
14
13
  module.exports = getExternals;
@@ -29,8 +29,8 @@ const getOptimization = () => {
29
29
  // 这里的体积大小时指压缩前的
30
30
  obj.splitChunks = {
31
31
  chunks: "all", // initial | all | async all 表明了在异步和同步之间共享
32
- minSize: 10000, // 生成 chunk 的最小体积(以 bytes 为单位) 不限制
33
- maxSize: 500000, // 封装的模块的最小体积 0 不限制
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
@@ -38,25 +38,29 @@ const getOptimization = () => {
38
38
  // enforceSizeThreshold: 1000000000, // 如果代码块体积超过了 50000,则强制打包,无视其他配置
39
39
  cacheGroups: {
40
40
  // 缓存组
41
+ // ecoding: {
42
+ // chunks: "initial",
43
+ // name: "ecoding",
44
+ // test: /[\\/]node_modules\/@ecoding[\\/]/,
45
+ // // test: /[\\/]node_modules[\\/](react|react-dom|react-router-dom|redux|react-redux|redux-thunk|connected-react-router|hoist-non-react-statics)/,
46
+ // minSize: 0,
47
+ // enforce: true, // ignore splitChunks.minSize, splitChunks.minChunks, splitChunks.maxAsyncRequests and splitChunks.maxInitialRequests
48
+ // priority: 30
49
+ // },
41
50
  vendors: {
51
+ chunks: "initial",
42
52
  name: "vendors",
43
53
  test: /[\\/]node_modules[\\/]/,
44
54
  // test: /[\\/]node_modules[\\/](react|react-dom|react-router-dom|redux|react-redux|redux-thunk|connected-react-router|hoist-non-react-statics)/,
45
- // minSize: 0,
55
+ minSize: 0,
46
56
  enforce: true, // ignore splitChunks.minSize, splitChunks.minChunks, splitChunks.maxAsyncRequests and splitChunks.maxInitialRequests
47
- priority: -10
57
+ priority: 20
48
58
  },
49
- // vendors2: {
50
- // name: 'vendors2',
51
- // test: /[\\/]node_modules[\\/](axios)/,
52
- // // minSize: 0,
53
- // priority: -10,
54
- // },
55
- default: {
59
+ commons: {
60
+ chunks: "initial",
61
+ priority: 10,
56
62
  test: /[\\/]src[\\/]/,
57
63
  minChunks: 2, // 如果一个模块被引用2次的话,会单独提取
58
- priority: -20, // 优先级
59
- reuseExistingChunk: true // 是否使用其他已被分割出去的代码块
60
64
  }
61
65
  }
62
66
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecoding/base.build",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "tpl building",
5
5
  "author": "cxc",
6
6
  "license": "MIT",
@@ -53,5 +53,5 @@
53
53
  "publishConfig": {
54
54
  "access": "public"
55
55
  },
56
- "gitHead": "acd01aeb47d3f1e9b9fffbccb9caeb55c380b31f"
56
+ "gitHead": "e374b2cf6a5ba003c945af93d7979b745d7540df"
57
57
  }