akfun 1.6.13 → 2.0.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "akfun",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "前端脚手架:支持Vue技术栈和react技术栈",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"前端工程",
|
|
@@ -147,9 +147,9 @@
|
|
|
147
147
|
"vue-loader": "^15.9.2",
|
|
148
148
|
"vue-style-loader": "^4.1.2",
|
|
149
149
|
"vue-template-compiler": "^2.6.11",
|
|
150
|
-
"webpack": "^
|
|
150
|
+
"webpack": "^5.65.0",
|
|
151
151
|
"webpack-bundle-analyzer": "^3.8.0",
|
|
152
|
-
"webpack-cli": "^
|
|
152
|
+
"webpack-cli": "^4.9.1",
|
|
153
153
|
"webpack-dev-middleware": "^3.7.2",
|
|
154
154
|
"webpack-hot-middleware": "^2.25.0",
|
|
155
155
|
"webpack-merge": "^4.2.2",
|
|
@@ -5,6 +5,8 @@ const webpack = require('webpack');
|
|
|
5
5
|
const StyleLintPlugin = require('stylelint-webpack-plugin');
|
|
6
6
|
const VueLoaderPlugin = require('vue-loader/lib/plugin');
|
|
7
7
|
const nodeExternals = require('webpack-node-externals');
|
|
8
|
+
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
|
|
9
|
+
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
|
8
10
|
const utils = require('./loaderUtils');
|
|
9
11
|
const vueLoaderConfig = require('./vue-loader.conf');
|
|
10
12
|
const { resolve, resolveToCurrentRoot } = require('../utils/pathUtils');
|
|
@@ -37,6 +39,9 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
|
|
|
37
39
|
const curProjectDir = getProjectDir(curWebpackConfig.projectDir);
|
|
38
40
|
const webpackConfig = {
|
|
39
41
|
entry: curWebpackConfig.entry,
|
|
42
|
+
// target: 'web', // <=== 默认为 'web',可省略
|
|
43
|
+
target: ['web', 'es5'], // 使用共同的特性子集
|
|
44
|
+
// target: false, // 不使用任何插件
|
|
40
45
|
/*
|
|
41
46
|
内置变量列表:
|
|
42
47
|
id: chunk的唯一标识,从0开始;
|
|
@@ -148,8 +153,13 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
|
|
|
148
153
|
},
|
|
149
154
|
plugins: [
|
|
150
155
|
BannerPack,
|
|
156
|
+
new webpack.DefinePlugin({
|
|
157
|
+
'process.env.NODE_ENV': JSON.stringify(curEnvConfig.NODE_ENV)
|
|
158
|
+
}),
|
|
151
159
|
// 请确保引入这个插件来施展魔法
|
|
152
|
-
new VueLoaderPlugin()
|
|
160
|
+
new VueLoaderPlugin(),
|
|
161
|
+
new FriendlyErrorsPlugin(),
|
|
162
|
+
new ProgressBarPlugin()
|
|
153
163
|
]
|
|
154
164
|
};
|
|
155
165
|
// 优先使用执行环境中的配置
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
const webpack = require('webpack');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const merge = require('webpack-merge');
|
|
4
|
-
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
|
|
5
|
-
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
|
6
4
|
const utils = require('./loaderUtils');
|
|
7
5
|
// 引入当前项目配置文件
|
|
8
6
|
const projectConfig = require('../config/index');
|
|
@@ -32,17 +30,32 @@ module.exports = (akfunConfig) => {
|
|
|
32
30
|
environment: 'dev'
|
|
33
31
|
})
|
|
34
32
|
},
|
|
35
|
-
// cheap-module-eval-source-map
|
|
36
|
-
devtool: '
|
|
33
|
+
// devtool: '#cheap-module-eval-source-map', // 本地开发环境中的取值
|
|
34
|
+
devtool: curEnvConfig.productionSourceMap ? curEnvConfig.devtool || 'eval-source-map' : 'eval', // 开发环境
|
|
35
|
+
optimization: {
|
|
36
|
+
chunkIds: 'named', // named 对调试更友好的可读的 id。
|
|
37
|
+
emitOnErrors: true,
|
|
38
|
+
splitChunks: {
|
|
39
|
+
cacheGroups: {
|
|
40
|
+
defaultVendors: { // 4.0: vendors
|
|
41
|
+
test: /node_modules\/(.*)/,
|
|
42
|
+
name: 'vendor',
|
|
43
|
+
chunks: 'initial',
|
|
44
|
+
reuseExistingChunk: true
|
|
45
|
+
},
|
|
46
|
+
common: {
|
|
47
|
+
name: 'common',
|
|
48
|
+
minChunks: 2,
|
|
49
|
+
priority: -20,
|
|
50
|
+
chunks: 'initial',
|
|
51
|
+
reuseExistingChunk: true
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
37
56
|
plugins: [
|
|
38
|
-
new webpack.DefinePlugin({
|
|
39
|
-
'process.env.NODE_ENV': JSON.stringify(curEnvConfig.NODE_ENV) // vue-router中根据此变量判断执行环境
|
|
40
|
-
}),
|
|
41
57
|
// https://github.com/glenjamin/webpack-hot-middleware#installation--usage
|
|
42
58
|
new webpack.HotModuleReplacementPlugin(),
|
|
43
|
-
new webpack.NoEmitOnErrorsPlugin(),
|
|
44
|
-
new FriendlyErrorsPlugin(),
|
|
45
|
-
new ProgressBarPlugin()
|
|
46
59
|
]
|
|
47
60
|
});
|
|
48
61
|
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
const webpack = require('webpack');
|
|
2
1
|
const merge = require('webpack-merge');
|
|
3
2
|
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');
|
|
4
3
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); // 替换extract-text-webpack-plugin
|
|
5
4
|
const CompressionWebpackPlugin = require('compression-webpack-plugin');
|
|
6
5
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
7
|
-
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
|
|
8
|
-
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
|
9
6
|
|
|
10
7
|
const utils = require('./loaderUtils');
|
|
11
8
|
// 引入当前项目配置文件
|
|
@@ -22,11 +19,14 @@ module.exports = (akfunConfig) => {
|
|
|
22
19
|
mode: curEnvConfig.NODE_ENV, // production 模式,会启动UglifyJsPlugin服务
|
|
23
20
|
output: {
|
|
24
21
|
path: curEnvConfig.assetsRoot, // 输出文件的存放在本地的目录
|
|
25
|
-
filename: '
|
|
22
|
+
filename: 'index.umd.js',
|
|
26
23
|
publicPath: '',
|
|
27
|
-
library:
|
|
24
|
+
library: {
|
|
25
|
+
type: 'umd', // 定义打包方式Universal Module Definition,同时支持在CommonJS、AMD和全局变量使用
|
|
26
|
+
name: curEnvConfig.libraryName,
|
|
27
|
+
},
|
|
28
|
+
// 指定类库名,主要用于直接引用的方式(比如使用script 标签)
|
|
28
29
|
globalObject: 'this', // 定义全局变量,兼容node和浏览器运行,避免出现"window is not defined"的情况
|
|
29
|
-
libraryTarget: 'umd' // 定义打包方式Universal Module Definition,同时支持在CommonJS、AMD和全局变量使用
|
|
30
30
|
},
|
|
31
31
|
module: {
|
|
32
32
|
rules: utils.styleLoaders({
|
|
@@ -34,11 +34,16 @@ module.exports = (akfunConfig) => {
|
|
|
34
34
|
environment: 'prod'
|
|
35
35
|
})
|
|
36
36
|
},
|
|
37
|
-
devtool:
|
|
37
|
+
devtool: curEnvConfig.productionSourceMap ? curEnvConfig.devtool || 'source-map' : false, // 线上生成环境
|
|
38
|
+
optimization: {
|
|
39
|
+
/**
|
|
40
|
+
* named 对调试更友好的可读的 id。
|
|
41
|
+
* deterministic 在不同的编译中不变的短数字 id。有益于长期缓存。在生产模式中会默认开启。
|
|
42
|
+
*/
|
|
43
|
+
chunkIds: 'named',
|
|
44
|
+
emitOnErrors: true
|
|
45
|
+
},
|
|
38
46
|
plugins: [
|
|
39
|
-
new webpack.DefinePlugin({
|
|
40
|
-
'process.env.NODE_ENV': JSON.stringify(curEnvConfig.NODE_ENV)
|
|
41
|
-
}),
|
|
42
47
|
new MiniCssExtractPlugin({
|
|
43
48
|
// filename: utils.assetsPath('index.css'),
|
|
44
49
|
filename: "[name].css",
|
|
@@ -50,8 +55,6 @@ module.exports = (akfunConfig) => {
|
|
|
50
55
|
safe: true
|
|
51
56
|
}
|
|
52
57
|
}),
|
|
53
|
-
new FriendlyErrorsPlugin(),
|
|
54
|
-
new ProgressBarPlugin()
|
|
55
58
|
]
|
|
56
59
|
});
|
|
57
60
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
|
-
const webpack = require('webpack');
|
|
4
3
|
const merge = require('webpack-merge');
|
|
5
4
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
6
5
|
// const ExtractTextPlugin = require('extract-text-webpack-plugin'); // 不支持webpack4.0
|
|
@@ -8,8 +7,6 @@ const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');
|
|
|
8
7
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); // 替换extract-text-webpack-plugin
|
|
9
8
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
10
9
|
const CompressionWebpackPlugin = require('compression-webpack-plugin');
|
|
11
|
-
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
|
|
12
|
-
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
|
13
10
|
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
|
|
14
11
|
|
|
15
12
|
const utils = require('./loaderUtils');
|
|
@@ -52,12 +49,13 @@ module.exports = (akfunConfig) => {
|
|
|
52
49
|
environment: 'prod'
|
|
53
50
|
})
|
|
54
51
|
},
|
|
55
|
-
|
|
56
|
-
devtool: curEnvConfig.productionSourceMap ? '#source-map' : false, // 线上开发环境中的取值
|
|
52
|
+
devtool: curEnvConfig.productionSourceMap ? curEnvConfig.devtool || 'source-map' : false, // 线上生成环境
|
|
57
53
|
optimization: {
|
|
54
|
+
chunkIds: 'deterministic', // 在不同的编译中不变的短数字 id。有益于长期缓存。在生产模式中会默认开启。
|
|
55
|
+
emitOnErrors: true,
|
|
58
56
|
splitChunks: {
|
|
59
57
|
cacheGroups: {
|
|
60
|
-
|
|
58
|
+
defaultVendors: { // 4.0: vendors
|
|
61
59
|
test: /node_modules\/(.*)/,
|
|
62
60
|
name: 'vendor',
|
|
63
61
|
chunks: 'initial',
|
|
@@ -74,10 +72,6 @@ module.exports = (akfunConfig) => {
|
|
|
74
72
|
}
|
|
75
73
|
},
|
|
76
74
|
plugins: [
|
|
77
|
-
// http://vuejs.github.io/vue-loader/en/workflow/production.html
|
|
78
|
-
new webpack.DefinePlugin({
|
|
79
|
-
'process.env.NODE_ENV': JSON.stringify(curEnvConfig.NODE_ENV) // vue-router中根据此变量判断执行环境
|
|
80
|
-
}),
|
|
81
75
|
new MiniCssExtractPlugin({
|
|
82
76
|
filename: utils.assetsPath('css/[name].[contenthash:8].css'),
|
|
83
77
|
ignoreOrder: false // Enable to remove warnings about conflicting order
|
|
@@ -97,8 +91,6 @@ module.exports = (akfunConfig) => {
|
|
|
97
91
|
safe: true
|
|
98
92
|
}
|
|
99
93
|
}),
|
|
100
|
-
new FriendlyErrorsPlugin(),
|
|
101
|
-
new ProgressBarPlugin()
|
|
102
94
|
]
|
|
103
95
|
});
|
|
104
96
|
|