kn-cli 1.0.100 → 1.0.102

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.
@@ -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.42.0",
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"
@@ -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(devMode){
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
- module.exports = {
485
+ const config={
479
486
  mode: devMode ? 'development' : 'production',
480
487
  devtool:false,
481
488
  devServer: {
@@ -514,3 +521,14 @@ module.exports = {
514
521
  optimization: optimization,
515
522
  plugins: plugins,
516
523
  };
524
+
525
+ if(CLI_CONFIG?.cache){
526
+ config.cache = CLI_CONFIG.cache;
527
+ }
528
+ if(devServer?.hot != undefined){
529
+ config.devServer.hot = devServer.hot;
530
+ }
531
+ warn(`=====================webpack config=========================`);
532
+ console.log(config)
533
+ warn(`=====================webpack config end=========================`);
534
+ module.exports = config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kn-cli",
3
- "version": "1.0.100",
3
+ "version": "1.0.102",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,9 +1,28 @@
1
1
  {
2
2
  "editor.tabSize": 2,
3
+ "editor.indentSize": "tabSize",
3
4
  "files.exclude": {
4
5
  "**/node_modules": true,
5
6
  },
6
7
  "search.exclude": {
7
8
  "**/release": true,
8
- }
9
+ },
10
+ // 控制折行的方式
11
+ "editor.wordWrap": "off",
12
+ // 控制树缩进(以像素为单位)。
13
+ "workbench.tree.indent": 16,
14
+ // jsx中使用单引号
15
+ "prettier.jsxSingleQuote": true,
16
+ // 代码块的开和闭合处会有一条引导线连接起来
17
+ "editor.guides.bracketPairs": true,
18
+ // 右侧缩略图宽度
19
+ "editor.minimap.maxColumn": 60,
20
+ // 滚轮缩放字体
21
+ "editor.mouseWheelZoom": true,
22
+ // 控制编辑器是否可以滚动到最后一行之后。
23
+ "editor.scrollBeyondLastLine": false,
24
+ // 代码可折叠的情况下,折叠符号一直展示
25
+ "editor.showFoldingControls": "always",
26
+ "workbench.list.smoothScrolling": true,
27
+ "workbench.tree.renderIndentGuides": "always",
9
28
  }
@@ -1,9 +1,28 @@
1
1
  {
2
2
  "editor.tabSize": 2,
3
+ "editor.indentSize": "tabSize",
3
4
  "files.exclude": {
4
5
  "**/node_modules": true,
5
6
  },
6
7
  "search.exclude": {
7
8
  "**/release": true,
8
- }
9
+ },
10
+ // 控制折行的方式
11
+ "editor.wordWrap": "off",
12
+ // 控制树缩进(以像素为单位)。
13
+ "workbench.tree.indent": 16,
14
+ // jsx中使用单引号
15
+ "prettier.jsxSingleQuote": true,
16
+ // 代码块的开和闭合处会有一条引导线连接起来
17
+ "editor.guides.bracketPairs": true,
18
+ // 右侧缩略图宽度
19
+ "editor.minimap.maxColumn": 60,
20
+ // 滚轮缩放字体
21
+ "editor.mouseWheelZoom": true,
22
+ // 控制编辑器是否可以滚动到最后一行之后。
23
+ "editor.scrollBeyondLastLine": false,
24
+ // 代码可折叠的情况下,折叠符号一直展示
25
+ "editor.showFoldingControls": "always",
26
+ "workbench.list.smoothScrolling": true,
27
+ "workbench.tree.renderIndentGuides": "always",
9
28
  }
@@ -1,9 +1,28 @@
1
1
  {
2
2
  "editor.tabSize": 2,
3
+ "editor.indentSize": "tabSize",
3
4
  "files.exclude": {
4
5
  "**/node_modules": true,
5
6
  },
6
7
  "search.exclude": {
7
8
  "**/release": true,
8
- }
9
+ },
10
+ // 控制折行的方式
11
+ "editor.wordWrap": "off",
12
+ // 控制树缩进(以像素为单位)。
13
+ "workbench.tree.indent": 16,
14
+ // jsx中使用单引号
15
+ "prettier.jsxSingleQuote": true,
16
+ // 代码块的开和闭合处会有一条引导线连接起来
17
+ "editor.guides.bracketPairs": true,
18
+ // 右侧缩略图宽度
19
+ "editor.minimap.maxColumn": 60,
20
+ // 滚轮缩放字体
21
+ "editor.mouseWheelZoom": true,
22
+ // 控制编辑器是否可以滚动到最后一行之后。
23
+ "editor.scrollBeyondLastLine": false,
24
+ // 代码可折叠的情况下,折叠符号一直展示
25
+ "editor.showFoldingControls": "always",
26
+ "workbench.list.smoothScrolling": true,
27
+ "workbench.tree.renderIndentGuides": "always",
9
28
  }
@@ -1,9 +1,28 @@
1
1
  {
2
2
  "editor.tabSize": 2,
3
+ "editor.indentSize": "tabSize",
3
4
  "files.exclude": {
4
5
  "**/node_modules": true,
5
6
  },
6
7
  "search.exclude": {
7
8
  "**/release": true,
8
- }
9
+ },
10
+ // 控制折行的方式
11
+ "editor.wordWrap": "off",
12
+ // 控制树缩进(以像素为单位)。
13
+ "workbench.tree.indent": 16,
14
+ // jsx中使用单引号
15
+ "prettier.jsxSingleQuote": true,
16
+ // 代码块的开和闭合处会有一条引导线连接起来
17
+ "editor.guides.bracketPairs": true,
18
+ // 右侧缩略图宽度
19
+ "editor.minimap.maxColumn": 60,
20
+ // 滚轮缩放字体
21
+ "editor.mouseWheelZoom": true,
22
+ // 控制编辑器是否可以滚动到最后一行之后。
23
+ "editor.scrollBeyondLastLine": false,
24
+ // 代码可折叠的情况下,折叠符号一直展示
25
+ "editor.showFoldingControls": "always",
26
+ "workbench.list.smoothScrolling": true,
27
+ "workbench.tree.renderIndentGuides": "always",
9
28
  }
@@ -1,9 +1,28 @@
1
1
  {
2
2
  "editor.tabSize": 2,
3
+ "editor.indentSize": "tabSize",
3
4
  "files.exclude": {
4
5
  "**/node_modules": true,
5
6
  },
6
7
  "search.exclude": {
7
8
  "**/release": true,
8
- }
9
+ },
10
+ // 控制折行的方式
11
+ "editor.wordWrap": "off",
12
+ // 控制树缩进(以像素为单位)。
13
+ "workbench.tree.indent": 16,
14
+ // jsx中使用单引号
15
+ "prettier.jsxSingleQuote": true,
16
+ // 代码块的开和闭合处会有一条引导线连接起来
17
+ "editor.guides.bracketPairs": true,
18
+ // 右侧缩略图宽度
19
+ "editor.minimap.maxColumn": 60,
20
+ // 滚轮缩放字体
21
+ "editor.mouseWheelZoom": true,
22
+ // 控制编辑器是否可以滚动到最后一行之后。
23
+ "editor.scrollBeyondLastLine": false,
24
+ // 代码可折叠的情况下,折叠符号一直展示
25
+ "editor.showFoldingControls": "always",
26
+ "workbench.list.smoothScrolling": true,
27
+ "workbench.tree.renderIndentGuides": "always",
9
28
  }