fix: 修复支付宝小程序开发预览报错问题 - #16715
Merged
Merged
Conversation
* main: fix: 修复solid的onShow,onHide不生效的bug (#16569) fix(taro-cli): 修正tsconfig-paths-webpack-plugin插件的导入条件 fix(taro-cli): 使TS条件下生成的模板,import与export间保持一行空隙,以避免ESLint报错
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #16715 +/- ##
========================================
Coverage 58.51% 58.51%
========================================
Files 466 466
Lines 27115 27115
Branches 5894 5712 -182
========================================
Hits 15866 15866
+ Misses 9895 9801 -94
- Partials 1354 1448 +94
Flags with carried forward coverage won't be shown. Click here to find out more. |
ZEJIA-LIU
approved these changes
Oct 15, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
这个 PR 做了什么? (简要描述所做更改)
问题描述
Taro 4.x 构建支付宝小程序,在开发工具上预览会报如下错误:
问题原因
Taro 4.x 后,更新了 browserslist 的配置,默认仅支持 ES6 的导出
e87d6ab#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R196
解决办法
问题一:
开发工具预览报错,无法启动:
解决办法:
由于支付宝小程序开发工具会读取项目中的 browserslist 配置,以提前暴露问题,所以为了禁用这个逻辑,可以在 dist 目录中增加
.browserslistrc配置,并设置内容为:问题二:
Taro 在 dev 模式下,构建支付宝小程序产出的是 ES6 的代码,用户在使用支付宝小程序开发者工具时,默认不会转换 node_modules 的代码,会产生以下报错:
解决办法:
开启开发者工具的 transpile 配置,即在
mini.project.json或者project.alipay.json配置中添加如下配置:文档:https://opendocs.alipay.com/mini/03dbc3?pathHash=e876dc50#transpile
这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台: