kn-cli 1.0.27 → 1.0.29
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 +8 -4
- package/package.json +1 -1
- package/readme.md +6 -0
package/build/webpack.config.js
CHANGED
|
@@ -38,6 +38,8 @@ const resource_path_relative= CLI_CONFIG?.site_root_path??'';
|
|
|
38
38
|
const support_sass=CLI_CONFIG?.sass??false;
|
|
39
39
|
const css_modules= CLI_CONFIG?.cssModule??'local';
|
|
40
40
|
const jsSplitMode = CLI_CONFIG?.jsSplitMode??true;
|
|
41
|
+
const indexHtml = CLI_CONFIG?.indexHtml ?? true;
|
|
42
|
+
|
|
41
43
|
let distFolder = 'dist';
|
|
42
44
|
let distJsFolder='';
|
|
43
45
|
if(CLI_CONFIG?.dist){
|
|
@@ -308,9 +310,11 @@ const optimization= {
|
|
|
308
310
|
};
|
|
309
311
|
if(jsSplitMode){
|
|
310
312
|
if(jsSplitMode===true||jsSplitMode?.runtime!==false){
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
313
|
+
if(indexHtml){//只有当会注入到html内时才允许带runtime,避免多entry情况下入口js变为chunk.js
|
|
314
|
+
optimization.runtimeChunk= {
|
|
315
|
+
name: 'runtime', // 所有入口有自己的runtime.js
|
|
316
|
+
};
|
|
317
|
+
}
|
|
314
318
|
}
|
|
315
319
|
optimization.splitChunks= {
|
|
316
320
|
cacheGroups: {
|
|
@@ -373,7 +377,7 @@ const plugins= [
|
|
|
373
377
|
})
|
|
374
378
|
];
|
|
375
379
|
|
|
376
|
-
|
|
380
|
+
|
|
377
381
|
if(indexHtml){
|
|
378
382
|
const shareJs = jsSplitMode?['react-bundle', 'modules-bundle', 'default-bundle', 'styles-bundle']:[];
|
|
379
383
|
if(jsSplitMode===true || jsSplitMode?.runtime !== false){
|
package/package.json
CHANGED