akfun 5.1.6 → 5.1.8

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.6",
3
+ "version": "5.1.8",
4
4
  "description": "前端脚手架:支持Vue技术栈和react技术栈",
5
5
  "keywords": [
6
6
  "前端工程",
package/src/build.js CHANGED
@@ -10,7 +10,7 @@ const defaultConfig = require('./config/default.config');
10
10
  const deepMergeConfig = require('./utils/deepMergeConfig');
11
11
 
12
12
  // 构建脚本:一般用于构建生产环境的代码
13
- module.exports = function (BuildType, akfunConfig, _consoleTag) {
13
+ module.exports = function (BuildType, akfunConfig, _consoleTag, callbackFunc) {
14
14
  const consoleTag = _consoleTag || curConsoleTag;
15
15
  let config = projectConfig; // 默认使用执行命令目录下的配置数据
16
16
  if (akfunConfig) {
@@ -62,6 +62,11 @@ module.exports = function (BuildType, akfunConfig, _consoleTag) {
62
62
  }
63
63
 
64
64
  console.log(chalk.cyan(' 构建完成.\n'));
65
+
66
+ // 如果用户传入了回调函数,则执行回调函数
67
+ if (callbackFunc) {
68
+ callbackFunc(curEnvConfig);
69
+ }
65
70
  });
66
71
  });
67
72
  };
@@ -12,10 +12,7 @@ const fileExists = function (fileDir) {
12
12
  module.exports = function (currentConfigDir) {
13
13
  let currentConfig = {};
14
14
  if (fileExists(currentConfigDir)) {
15
- const configObj = require(currentConfigDir);
16
- if (configObj) {
17
- currentConfig = configObj;
18
- }
15
+ currentConfig = require(currentConfigDir);
19
16
  }
20
17
  return currentConfig;
21
18
  };
@@ -96,12 +96,14 @@ module.exports = (akfunConfig) => {
96
96
  plugins: []
97
97
  });
98
98
 
99
- // 使用用户自定义的多入口配置,生产对应的多页面多模板
100
- const htmlWebpackPluginList = entrys2htmlWebpackPlugin(webpackProdConfig.entry, curHtmlTemplate);
99
+ if (!webpackProdConfig.closeHtmlWebpackPlugin) {
100
+ // 使用用户自定义的多入口配置,生产对应的多页面多模板
101
+ const htmlWebpackPluginList = entrys2htmlWebpackPlugin(webpackProdConfig.entry, curHtmlTemplate);
101
102
 
102
- htmlWebpackPluginList.forEach((htmlWebpackPlugin) => {
103
- webpackProdConfig.plugins.push(htmlWebpackPlugin);
104
- });
103
+ htmlWebpackPluginList.forEach((htmlWebpackPlugin) => {
104
+ webpackProdConfig.plugins.push(htmlWebpackPlugin);
105
+ });
106
+ }
105
107
 
106
108
  // 判断是否有public目录,如果有需要转移到dist目录下
107
109
  if (fs.existsSync(resolve('public'))) {