akfun 3.1.0 → 3.1.5

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.1.0",
3
+ "version": "3.1.5",
4
4
  "description": "前端脚手架:支持Vue技术栈和react技术栈",
5
5
  "keywords": [
6
6
  "前端工程",
package/src/dev-server.js CHANGED
@@ -111,25 +111,26 @@ module.exports = function (akfunConfig, _consoleTag) {
111
111
  if (err) {
112
112
  _reject(err);
113
113
  }
114
+ spinner.succeed(`${consoleTag}调试模式已开启!`);
115
+
114
116
  process.env.PORT = port;
115
117
  const uri = `http://${config.dev.hostname}:${port}`;
116
-
117
118
  console.log(`> Listening at ${uri}\n`);
118
- // 如果是开发环境,自动打开浏览器并跳到项目首页
119
- if (autoOpenBrowser) {
120
- spinner.succeed(`${consoleTag}调试模式已开启!`);
121
- // 打印当前环境中的首个html和css地址
122
- const projPath = `${uri}${webpackConfig.output.publicPath}`;
123
- let entryConfig = webpackConfig.entry || {}; // 获取构建入口配置
124
- const entryFiles = (entryConfig && Object.keys(entryConfig)) || [];
125
- if (entryFiles.length > 0) {
126
- // 获取第一个入口文件
127
- const filename = entryFiles[0];
128
- console.info(
129
- `当前运行脚本:\n ${projPath}${filename}.js\n当前运行样式[可能不存在]:\n${projPath}${filename}.css`
130
- );
131
- open(`${projPath}${filename}.html`, { wait: true });
132
- }
119
+
120
+ // 打印当前环境中的首个html和css地址
121
+ const projPath = `${uri}${webpackConfig.output.publicPath}`;
122
+ let entryConfig = webpackConfig.entry || {}; // 获取构建入口配置
123
+ const entryFiles = (entryConfig && Object.keys(entryConfig)) || [];
124
+ if (entryFiles.length > 0) {
125
+ // 获取第一个入口文件
126
+ const filename = entryFiles[0];
127
+ console.info(
128
+ `当前运行脚本:\n ${projPath}${filename}.js\n当前运行样式[可能不存在]:\n${projPath}${filename}.css`
129
+ );
130
+ }
131
+ // 是否自动打开浏览器并跳到项目首页
132
+ if (!config.dev.closeHtmlWebpackPlugin && autoOpenBrowser) {
133
+ open(`${projPath}${filename}.html`, { wait: true });
133
134
  }
134
135
  server = app.listen(port);
135
136
  _resolve();
@@ -308,7 +308,7 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
308
308
  // 判断是否有自定义plugins
309
309
  if (curWebpackConfig.plugins && Array.isArray(curWebpackConfig.plugins)) {
310
310
  // 添加自定义webpack插件
311
- webpackConfig.plugins.concat(curWebpackConfig.plugins);
311
+ webpackConfig.plugins.push(...curWebpackConfig.plugins);
312
312
  }
313
313
 
314
314
  return webpackConfig;
@@ -52,11 +52,13 @@ module.exports = (akfunConfig) => {
52
52
  ]
53
53
  });
54
54
 
55
- // 使用用户自定义的多入口配置,生产对应的多页面多模板(优先使用用户的自定义页面模板)
56
- const htmlWebpackPluginList = entrys2htmlWebpackPlugin(webpackDevConfig.entry, curHtmlTemplate);
57
- htmlWebpackPluginList.forEach((htmlWebpackPlugin) => {
58
- webpackDevConfig.plugins.push(htmlWebpackPlugin);
59
- });
55
+ if (!webpackDevConfig.closeHtmlWebpackPlugin) {
56
+ // 使用用户自定义的多入口配置,生产对应的多页面多模板(优先使用用户的自定义页面模板)
57
+ const htmlWebpackPluginList = entrys2htmlWebpackPlugin(webpackDevConfig.entry, curHtmlTemplate);
58
+ htmlWebpackPluginList.forEach((htmlWebpackPlugin) => {
59
+ webpackDevConfig.plugins.push(htmlWebpackPlugin);
60
+ });
61
+ }
60
62
 
61
63
  // 开启热更新能力
62
64
  const devClientPath = path.resolve(__dirname, '../dev-client'); // 从akfun中获取