-
Notifications
You must be signed in to change notification settings - Fork 4.9k
fix(taro-platform-h5): 修复windows开发环境Taro对象上等方法不可用 #18153
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
用路径边界判断与基于 cleanId 的后缀匹配,避免误判与平台差异
当前仍然存在两处潜在问题:
建议在本段内改为“边界安全的目录判断 + 基于 cleanId 的结尾扩展匹配”,示例 diff 如下:
这样可同时解决:
📝 Committable suggestion
🤖 Prompt for AI Agents
💡 Verification agent
🧩 Analysis chain
建议对全仓库同类判定做一致性巡检
为避免类似 Windows 路径问题在其它插件/分支重复出现,建议巡检是否还有基于 id.startsWith(sourceDir) 的直接字符串比较,并统一采用“清洗 + 路径边界 + 扩展名后缀”的写法。
可用以下脚本在仓库检索潜在位置,人工复核是否需要采用同样规范化处理:
🏁 Script executed:
Length of output: 6180
统一路径前缀匹配时的清洗及后缀校验
为避免 Windows 下反斜杠和 query 参数导致匹配失效,全仓库所有基于
sourceDir的startsWith判定都应按以下流程处理:\u0000)和?及后续参数\统一替换为/startsWith(normalizedSourceDir),并尽量结合路径边界(如normalizedSourceDir + '/')exts.some(ext => cleanId.endsWith(ext)))以下位置需同样引入该规范化处理:
transform钩子中对id.startsWith(viteCompilerContext.sourceDir)及后续exts.some(id.includes))entryFileNames中对facadeModuleId.startsWith(sourceDir)的判断)可用脚本复核并定位所有潜在场景:
🤖 Prompt for AI Agents