kn-cli 1.0.23 → 1.0.25
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/postcss.config.js +0 -1
- package/build/webpack.config.js +16 -8
- package/package.json +1 -1
- package/readme.md +6 -0
- package/templates/template_app/dev.sh +3 -0
package/build/postcss.config.js
CHANGED
package/build/webpack.config.js
CHANGED
|
@@ -10,6 +10,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
10
10
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
11
11
|
const CopyPlugin = require('copy-webpack-plugin');
|
|
12
12
|
|
|
13
|
+
const NowDateTime = Date.now();
|
|
13
14
|
|
|
14
15
|
//////////// CONFIG ENV ///////////////
|
|
15
16
|
const API_CONFIG = require('./webpack.api.js');
|
|
@@ -90,6 +91,19 @@ if(CLI_CONFIG?.entry){
|
|
|
90
91
|
}
|
|
91
92
|
////////////// ENTRY-END ///////////////
|
|
92
93
|
|
|
94
|
+
////////////// OUTPUT ///////////////
|
|
95
|
+
const output= {
|
|
96
|
+
// devtoolModuleFilenameTemplate:'webpack:///dist/[resource-path]',
|
|
97
|
+
filename: `[name]${hashMode ? '-[chunkhash]' : ''}.js`,
|
|
98
|
+
path: path.join(dirname, distFolder,distJsFolder),
|
|
99
|
+
publicPath: resource_path_relative,
|
|
100
|
+
};
|
|
101
|
+
// 当非hash模式时,未防止chunk缓存,所以在资源后面增加参数用于区分
|
|
102
|
+
if(!hashMode){
|
|
103
|
+
output.chunkFilename = '[name].chunk.js?v='+NowDateTime;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
////////////// OUTPUT-END ///////////////
|
|
93
107
|
|
|
94
108
|
/////////////// RULES ////////////////
|
|
95
109
|
const rules= [
|
|
@@ -345,7 +359,7 @@ if(jsSplitMode){
|
|
|
345
359
|
|
|
346
360
|
const plugins= [
|
|
347
361
|
new webpack.DefinePlugin({
|
|
348
|
-
VERSION_HASH: JSON.stringify(`${
|
|
362
|
+
VERSION_HASH: JSON.stringify(`${NowDateTime}-${new Date().toLocaleString()}`),
|
|
349
363
|
BUILD_ENV: JSON.stringify(process.env.build_env),
|
|
350
364
|
MOCK: process.env.mock == 1 ? '1' : false, //JSON.stringify(process.env.mock)
|
|
351
365
|
...API_HOST,
|
|
@@ -462,13 +476,7 @@ module.exports = {
|
|
|
462
476
|
},
|
|
463
477
|
// 如果哪天不需要兼容ie11了,把这里@babel/polyfill去掉就行了
|
|
464
478
|
entry: entry,
|
|
465
|
-
output:
|
|
466
|
-
// devtoolModuleFilenameTemplate:'webpack:///dist/[resource-path]',
|
|
467
|
-
filename: `[name]${hashMode ? '-[chunkhash]' : ''}.js`,
|
|
468
|
-
// chunkFilename: 'js/[name]-[hash].chunk.js', // ./js/[name]-[hash].chunk.js
|
|
469
|
-
path: path.join(dirname, distFolder,distJsFolder),
|
|
470
|
-
publicPath: resource_path_relative,
|
|
471
|
-
},
|
|
479
|
+
output: output,
|
|
472
480
|
resolve: {
|
|
473
481
|
modules: [
|
|
474
482
|
path.resolve(dirname,'node_modules'),
|
package/package.json
CHANGED
package/readme.md
CHANGED