kn-cli 1.0.18 → 1.0.19
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/build/webpack.config.js +13 -8
- package/package.json +1 -1
- package/readme.md +6 -0
package/build/webpack.config.js
CHANGED
|
@@ -269,14 +269,16 @@ const optimization= {
|
|
|
269
269
|
|
|
270
270
|
};
|
|
271
271
|
if(jsSplitMode){
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
272
|
+
if(jsSplitMode===true||jsSplitMode?.runtime!==false){
|
|
273
|
+
optimization.runtimeChunk= {
|
|
274
|
+
name: 'runtime', // 所有入口有自己的runtime.js
|
|
275
|
+
};
|
|
276
|
+
}
|
|
275
277
|
optimization.splitChunks= {
|
|
276
278
|
cacheGroups: {
|
|
277
279
|
react: {
|
|
278
280
|
test: /(react)/,
|
|
279
|
-
priority:
|
|
281
|
+
priority: 100,
|
|
280
282
|
name: 'react-bundle',
|
|
281
283
|
chunks: 'all',
|
|
282
284
|
enforce: true,
|
|
@@ -290,15 +292,15 @@ if(jsSplitMode){
|
|
|
290
292
|
},
|
|
291
293
|
modules: {
|
|
292
294
|
test: /(node_modules)/,
|
|
293
|
-
priority:
|
|
295
|
+
priority: 90,
|
|
294
296
|
name: 'modules-bundle',
|
|
295
297
|
chunks: 'all',
|
|
296
298
|
enforce: true,
|
|
297
299
|
},
|
|
298
300
|
default: {
|
|
299
301
|
name: 'default-bundle',
|
|
300
|
-
minChunks:
|
|
301
|
-
priority:
|
|
302
|
+
minChunks: 3,
|
|
303
|
+
priority: 10,
|
|
302
304
|
chunks: 'all',
|
|
303
305
|
enforce: true,
|
|
304
306
|
},
|
|
@@ -335,7 +337,10 @@ const plugins= [
|
|
|
335
337
|
|
|
336
338
|
const indexHtml = CLI_CONFIG?.indexHtml ?? true;
|
|
337
339
|
if(indexHtml){
|
|
338
|
-
const shareJs = jsSplitMode?['
|
|
340
|
+
const shareJs = jsSplitMode?['react-bundle', 'modules-bundle', 'default-bundle', 'styles-bundle']:[];
|
|
341
|
+
if(jsSplitMode===true || jsSplitMode?.runtime !== false){
|
|
342
|
+
shareJs.splice(0,0,'runtime');
|
|
343
|
+
}
|
|
339
344
|
plugins.push(
|
|
340
345
|
new HtmlWebpackPlugin({
|
|
341
346
|
chunks: ['index',...shareJs],
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -39,6 +39,9 @@ module.exports = {
|
|
|
39
39
|
// return "local";
|
|
40
40
|
// },
|
|
41
41
|
jsSplitMode:false,//默认:true,false=关闭js的模块切割
|
|
42
|
+
// jsSplitMode:{
|
|
43
|
+
// runtime:false,//不单独生成runtime
|
|
44
|
+
// }
|
|
42
45
|
cssSplitMode:false,//默认:true,false=关闭css文件分隔,将css内置到js内
|
|
43
46
|
sass:true,//默认:false,true=开启sass支持,默认仅支持less
|
|
44
47
|
indexHtml:false,//默认:true,false=关闭index.html的注入
|
|
@@ -48,6 +51,9 @@ module.exports = {
|
|
|
48
51
|
|
|
49
52
|
# 更新日志
|
|
50
53
|
|
|
54
|
+
* 1.0.19
|
|
55
|
+
1. 对splitChunks内runtime的cli配置支持
|
|
56
|
+
|
|
51
57
|
* 1.0.18
|
|
52
58
|
1. cli.config.js增加配置项,具体可以参考cli.config.js内的注释
|
|
53
59
|
2. 在调试模式中增加-watch模式,以便一些前后端不分离的项目进行调试
|