akfun 5.1.8 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akfun",
3
- "version": "5.1.8",
3
+ "version": "5.1.9",
4
4
  "description": "前端脚手架:支持Vue技术栈和react技术栈",
5
5
  "keywords": [
6
6
  "前端工程",
@@ -73,7 +73,7 @@ module.exports = (akfunConfig) => {
73
73
  );
74
74
  }
75
75
 
76
- if (!webpackDevConfig.closeHtmlWebpackPlugin) {
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,9 +96,17 @@ module.exports = (akfunConfig) => {
96
96
  plugins: []
97
97
  });
98
98
 
99
- if (!webpackProdConfig.closeHtmlWebpackPlugin) {
99
+ // 优先使用当前环境配置中的output
100
+ if (curEnvConfig.output) {
101
+ webpackProdConfig.output = deepMergeConfig(webpackProdConfig.output, curEnvConfig.output);
102
+ }
103
+
104
+ if (!curEnvConfig.closeHtmlWebpackPlugin) {
100
105
  // 使用用户自定义的多入口配置,生产对应的多页面多模板
101
- const htmlWebpackPluginList = entrys2htmlWebpackPlugin(webpackProdConfig.entry, curHtmlTemplate);
106
+ const htmlWebpackPluginList = entrys2htmlWebpackPlugin(
107
+ webpackProdConfig.entry,
108
+ curHtmlTemplate
109
+ );
102
110
 
103
111
  htmlWebpackPluginList.forEach((htmlWebpackPlugin) => {
104
112
  webpackProdConfig.plugins.push(htmlWebpackPlugin);
@@ -106,7 +114,7 @@ module.exports = (akfunConfig) => {
106
114
  }
107
115
 
108
116
  // 判断是否有public目录,如果有需要转移到dist目录下
109
- if (fs.existsSync(resolve('public'))) {
117
+ if (!curEnvConfig.ignorePublicAssets && fs.existsSync(resolve('public'))) {
110
118
  // copy custom public assets
111
119
  webpackProdConfig.plugins.push(
112
120
  new CopyWebpackPlugin({