@autobest-ui/scripts 1.5.4-alpha.0 → 1.5.6-alpha.0

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/README.md CHANGED
@@ -89,10 +89,11 @@ module.exports = function(
89
89
  | buildClientLoadableConfig.writeToDiskFilename | build ssr 自定义按需加载路径存储库文件存放位置 |
90
90
 
91
91
  ##### 公共配置
92
- | 参数名 | 说明 |
93
- | ---- | ---- |
94
- | htmlPluginTemplate | client端,模板html路径 |
95
- | alias | debug, build 下文件别名,同webpack.resolve.alias一样 |
92
+ | 参数名 | 说明 |
93
+ |--------------------|------|
94
+ | htmlPluginTemplate | client端,模板html路径 |
95
+ | htmlPluginFavicon | client端,favicon.ico路径,也可以通过nginx配置 |
96
+ | alias | debug, build 下文件别名,同webpack.resolve.alias一样 |
96
97
 
97
98
  ## 自定义
98
99
 
package/common/start.js CHANGED
@@ -47,6 +47,16 @@ function openStartRun(webpackFactory) {
47
47
  const server = new WebpackDevServer(options, compiler);
48
48
  let hasOpenBrowser = false;
49
49
 
50
+ // 添加钩子函数,触发编译异常
51
+ compiler.hooks.failed.tap('CompilerFailed', error => {
52
+ if (error) {
53
+ // eslint-disable-next-line no-console
54
+ console.log(error);
55
+ server.close();
56
+ process.exit();
57
+ }
58
+ });
59
+
50
60
  // 添加钩子函数,弹出浏览器
51
61
  compiler.hooks.done.tap('OpenBrowser', () => {
52
62
  if (!hasOpenBrowser) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobest-ui/scripts",
3
- "version": "1.5.4-alpha.0",
3
+ "version": "1.5.6-alpha.0",
4
4
  "private": false,
5
5
  "description": "utils for project tools",
6
6
  "bin": {
@@ -92,5 +92,5 @@
92
92
  "webpack-merge": "5.8.0",
93
93
  "webpack-node-externals": "3.0.0"
94
94
  },
95
- "gitHead": "a3de34420fe8db755ad41e8103632dae3c907d83"
95
+ "gitHead": "bc24240c18d3ae0d10b629e937e4bc6bfb89955b"
96
96
  }
@@ -8,8 +8,9 @@ module.exports = (isProd, appConfig, extendEnv) => {
8
8
  const result = {
9
9
  plugins: [
10
10
  new HtmlWebpackPlugin({
11
- inject: true,
11
+ inject: 'body',
12
12
  template: getProjectPath(appConfig.htmlPluginTemplate),
13
+ favicon: appConfig.htmlPluginFavicon ? getProjectPath(appConfig.htmlPluginFavicon) : undefined,
13
14
  templateParameters: isProd
14
15
  ? (compilation, assets, tags, options) => {
15
16
  tags.headTags.forEach(tag => {
@@ -37,7 +37,8 @@ module.exports = function (appConfig, extendEnv) {
37
37
  }),
38
38
  new HtmlWebpackPlugin({
39
39
  inject: true,
40
- template: getProjectPath(appConfig.htmlPluginTemplate)
40
+ template: getProjectPath(appConfig.htmlPluginTemplate),
41
+ favicon: appConfig.htmlPluginFavicon ? getProjectPath(appConfig.htmlPluginFavicon) : undefined
41
42
  })
42
43
  ],
43
44
  resolve: {