Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 新增 webpack 不同级别编译错误处理方式 #14559

Merged
merged 13 commits into from
Dec 26, 2023

Conversation

beezen
Copy link
Contributor

@beezen beezen commented Sep 16, 2023

这个 PR 做了什么? (简要描述所做更改)

背景:当 Taro 框架在流水线的自动集成环节中进行编译构建时,编译错误并不会以非 0 退出码结束进程,导致无法判断构建生成发布物是否功能完善,容易造成事故。

目标:当 Taro 框架在流水线的自动集成环节中进行编译构建时,如果发生编译错误,应该以非 0 的退出码结束进程,以方便自动化脚本定义该次流程成功或失败。

目前 webpack 编译过程中的错误处理(Error Handling) 主要涉及以下三种类型的错误:

1、致命的 wepback 错误(配置出错等)
2、编译错误(缺失的 module,语法错误等)
3、编译警告

其中编译警告并不会影响应用功能的正常使用,无需考虑处理。

通过在工程编译配置中新增字段 errorLevel 来定义错误处理的严格模式。

参数值说明:

  • 0(默认 ) :表示只有发生“1、致命的webpack错误(配置出错等)”情况时,返回非 0 的退出码结束进程。
  • 1:表示发生“1、致命的 wepback 错误(配置出错等)2、编译错误(缺失的 module,语法错误等)”情况时,返回非 0 的退出码结束进程。

这个 PR 是什么类型? (至少选择一个)

  • 错误修复(Bugfix) issue: fix #
  • 新功能(Feature)
  • 代码重构(Refactor)
  • TypeScript 类型定义修改(Typings)
  • 文档修改(Docs)
  • 代码风格更新(Code style update)
  • 其他,请描述(Other, please describe):

这个 PR 涉及以下平台:

  • 所有小程序
  • 微信小程序
  • 支付宝小程序
  • 百度小程序
  • 字节跳动小程序
  • QQ 轻应用
  • 京东小程序
  • 快应用平台(QuickApp)
  • Web 平台(H5)
  • 移动端(React-Native)
  • 鸿蒙(harmony)

@taro-bot2
Copy link

taro-bot2 bot commented Sep 16, 2023

欢迎提交 PR~ Taro 非常感谢您对开源事业做出的贡献!🌷🌷🌷

一般 PR 会在一到两周内进行 review,成功合入后会随下一个版本进行发布。

Review 需要耗费大量时间,所以请遵循以下规范,协助我们提高 review 效率🙏🙏🙏

  1. 详细介绍 PR 的背景(非常重要,例如解决了什么问题,该问题如何复现等)
  2. 确保 CI 顺利运行。
  3. 最好能提供对应的测试用例。

为了更好地进行沟通,请加入 Taro 开发者微信群:

@Chen-jj
Copy link
Contributor

Chen-jj commented Sep 25, 2023

另外需要更新一下文档的 项目配置 部分

@beezen
Copy link
Contributor Author

beezen commented Sep 26, 2023

关联更新:
文档:NervJS/taro-docs#179
taro-doctor:NervJS/taro-doctor#8

@beezen
Copy link
Contributor Author

beezen commented Nov 10, 2023

@Chen-jj 健哥 这个特性如何了 后续cicd上想着能用上

@ZakaryCode ZakaryCode self-requested a review December 22, 2023 07:46
Copy link

codecov bot commented Dec 26, 2023

Codecov Report

Merging #14559 (4e170ac) into main (ae4c8f4) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14559   +/-   ##
=======================================
  Coverage   80.80%   80.80%           
=======================================
  Files           9        9           
  Lines         646      646           
  Branches      123      123           
=======================================
  Hits          522      522           
  Misses        110      110           
  Partials       14       14           

@ZEJIA-LIU
Copy link
Contributor

ZEJIA-LIU commented Dec 26, 2023 via email

@ZakaryCode
Copy link
Contributor

这个特性如何了 后续cicd上想着能用上

稍微调整了下,下一个版本上

@ZakaryCode ZakaryCode added this to the 3.6.22 milestone Dec 26, 2023
@ZakaryCode ZakaryCode requested a review from Chen-jj December 26, 2023 10:45
@ZakaryCode ZakaryCode merged commit 3633375 into NervJS:main Dec 26, 2023
13 checks passed
ZakaryCode added a commit that referenced this pull request Jan 15, 2024
* feat(webpack5-runner): 新增webpack5编译错误级别处理

* feat(webpack5-runner): 新增webpack4编译错误级别处理

* fix: 移除不必要的 any 类型

* fix: 移除 service 不必要的 files 配置

---------

Co-authored-by: chenjiajian <798095202@qq.com>
Co-authored-by: Zakary <zakarycode@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants