kn-cli 1.0.101 → 1.0.103
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/package.json +4 -2
- package/build/webpack.config.js +24 -4
- package/package.json +1 -1
package/build/package.json
CHANGED
|
@@ -53,10 +53,12 @@
|
|
|
53
53
|
"style-loader": "~1.1.3",
|
|
54
54
|
"terser-webpack-plugin": "~4.2.3",
|
|
55
55
|
"url-loader": "~3.0.0",
|
|
56
|
-
"webpack": "~4.
|
|
56
|
+
"webpack": "~4.43.0",
|
|
57
57
|
"webpack-bundle-analyzer": "~3.6.1",
|
|
58
58
|
"webpack-cli": "~3.3.11",
|
|
59
|
-
"webpack-dev-server": "~3.10.3"
|
|
59
|
+
"webpack-dev-server": "~3.10.3",
|
|
60
|
+
"@pmmmwh/react-refresh-webpack-plugin": "~0.4.3",
|
|
61
|
+
"react-refresh": "~0.9.0"
|
|
60
62
|
},
|
|
61
63
|
"engines": {
|
|
62
64
|
"node": "16.18.0"
|
package/build/webpack.config.js
CHANGED
|
@@ -9,12 +9,11 @@ const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
|
|
9
9
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
10
10
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
11
11
|
const CopyPlugin = require('copy-webpack-plugin');
|
|
12
|
-
|
|
12
|
+
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
|
13
13
|
const NowDateTime = Date.now();
|
|
14
14
|
|
|
15
15
|
//////////// CONFIG ENV ///////////////
|
|
16
16
|
const API_CONFIG = require('./webpack.api.js');
|
|
17
|
-
const cliConfig = require('./cli.config.js');
|
|
18
17
|
let CLI_CONFIG = {};
|
|
19
18
|
let existsCli= fs.existsSync('./cli.config.js');
|
|
20
19
|
if(existsCli){
|
|
@@ -162,6 +161,11 @@ const LOADER_JS=[
|
|
|
162
161
|
},
|
|
163
162
|
},
|
|
164
163
|
]
|
|
164
|
+
if(process.env.build_env == 'localdebug'){
|
|
165
|
+
if(devServer?.hot&&devServer?.reactRefresh==true){
|
|
166
|
+
LOADER_JS[0].options.plugins.push(['react-refresh/babel'])//
|
|
167
|
+
}
|
|
168
|
+
}
|
|
165
169
|
|
|
166
170
|
const rules= [
|
|
167
171
|
{
|
|
@@ -370,9 +374,12 @@ const plugins= [
|
|
|
370
374
|
PM_TYPE: JSON.stringify(process.env.pm_type),
|
|
371
375
|
APP_VERSION:JSON.stringify(appVersion)
|
|
372
376
|
}),
|
|
373
|
-
|
|
374
377
|
];
|
|
378
|
+
|
|
375
379
|
if(devMode){
|
|
380
|
+
if(devServer?.hot&&devServer?.reactRefresh==true){
|
|
381
|
+
plugins.push( new ReactRefreshWebpackPlugin() ) // 添加 React Refresh 插件
|
|
382
|
+
}
|
|
376
383
|
plugins.push(new webpack.SourceMapDevToolPlugin({
|
|
377
384
|
filename: 'sourcemap/[file].map',
|
|
378
385
|
// publicPath: '..',//resource_path_relative,
|
|
@@ -475,7 +482,7 @@ if(cssSplitMode){
|
|
|
475
482
|
// }
|
|
476
483
|
///////////// SPA-RENDER-END ///////////////
|
|
477
484
|
|
|
478
|
-
|
|
485
|
+
const config={
|
|
479
486
|
mode: devMode ? 'development' : 'production',
|
|
480
487
|
devtool:false,
|
|
481
488
|
devServer: {
|
|
@@ -514,3 +521,16 @@ module.exports = {
|
|
|
514
521
|
optimization: optimization,
|
|
515
522
|
plugins: plugins,
|
|
516
523
|
};
|
|
524
|
+
|
|
525
|
+
if(process.env.build_env == 'localdebug'){
|
|
526
|
+
if(CLI_CONFIG?.cache){
|
|
527
|
+
config.cache = CLI_CONFIG.cache;
|
|
528
|
+
}
|
|
529
|
+
if(devServer?.hot != undefined){
|
|
530
|
+
config.devServer.hot = devServer.hot;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
warn(`=====================webpack config=========================`);
|
|
534
|
+
console.log(config)
|
|
535
|
+
warn(`=====================webpack config end=========================`);
|
|
536
|
+
module.exports = config;
|