akfun 5.1.7 → 5.1.9
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
|
@@ -12,10 +12,7 @@ const fileExists = function (fileDir) {
|
|
|
12
12
|
module.exports = function (currentConfigDir) {
|
|
13
13
|
let currentConfig = {};
|
|
14
14
|
if (fileExists(currentConfigDir)) {
|
|
15
|
-
|
|
16
|
-
if (configObj) {
|
|
17
|
-
currentConfig = configObj;
|
|
18
|
-
}
|
|
15
|
+
currentConfig = require(currentConfigDir);
|
|
19
16
|
}
|
|
20
17
|
return currentConfig;
|
|
21
18
|
};
|
|
@@ -73,7 +73,7 @@ module.exports = (akfunConfig) => {
|
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
if (!
|
|
76
|
+
if (!curEnvConfig.closeHtmlWebpackPlugin) {
|
|
77
77
|
// 使用用户自定义的多入口配置,生产对应的多页面多模板(优先使用用户的自定义页面模板)
|
|
78
78
|
const htmlWebpackPluginList = entrys2htmlWebpackPlugin(webpackDevConfig.entry, curHtmlTemplate);
|
|
79
79
|
htmlWebpackPluginList.forEach((htmlWebpackPlugin) => {
|
|
@@ -58,6 +58,10 @@ module.exports = (akfunConfig) => {
|
|
|
58
58
|
* deterministic 在不同的编译中不变的短数字 id。有益于长期缓存。在生产模式中会默认开启。
|
|
59
59
|
*/
|
|
60
60
|
chunkIds: 'named',
|
|
61
|
+
/**
|
|
62
|
+
* 当 optimization.splitChunks 未配置或设置为 false 时,
|
|
63
|
+
* webpack 会将所有模块打包到一个 JS 文件中(除了异步加载的模块)。
|
|
64
|
+
*/
|
|
61
65
|
emitOnErrors: true,
|
|
62
66
|
// minimize: true,
|
|
63
67
|
minimizer: [
|
|
@@ -96,15 +96,25 @@ module.exports = (akfunConfig) => {
|
|
|
96
96
|
plugins: []
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
-
//
|
|
100
|
-
|
|
99
|
+
// 优先使用当前环境配置中的output
|
|
100
|
+
if (curEnvConfig.output) {
|
|
101
|
+
webpackProdConfig.output = deepMergeConfig(webpackProdConfig.output, curEnvConfig.output);
|
|
102
|
+
}
|
|
101
103
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
if (!curEnvConfig.closeHtmlWebpackPlugin) {
|
|
105
|
+
// 使用用户自定义的多入口配置,生产对应的多页面多模板
|
|
106
|
+
const htmlWebpackPluginList = entrys2htmlWebpackPlugin(
|
|
107
|
+
webpackProdConfig.entry,
|
|
108
|
+
curHtmlTemplate
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
htmlWebpackPluginList.forEach((htmlWebpackPlugin) => {
|
|
112
|
+
webpackProdConfig.plugins.push(htmlWebpackPlugin);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
105
115
|
|
|
106
116
|
// 判断是否有public目录,如果有需要转移到dist目录下
|
|
107
|
-
if (fs.existsSync(resolve('public'))) {
|
|
117
|
+
if (!curEnvConfig.ignorePublicAssets && fs.existsSync(resolve('public'))) {
|
|
108
118
|
// copy custom public assets
|
|
109
119
|
webpackProdConfig.plugins.push(
|
|
110
120
|
new CopyWebpackPlugin({
|