-
Notifications
You must be signed in to change notification settings - Fork 285
chore: 修复正式环境的 publicPath #3137
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
Conversation
Walkthrough该变更在配置文件中调整了 publicPath 的拼接逻辑和日志输出。新增在获取 Git hash 后,根据条件( Changes
Sequence Diagram(s)sequenceDiagram
participant App as 应用模块
participant Git as Git Hash 获取
participant Log as 日志输出
participant Config as 配置生成
App->>Git: 尝试获取 Git hash (try-catch)
Git-->>App: 返回 hash 值
alt hash 与 UI 均为真
App->>Log: 打印 "-{hash}"
App->>Config: 设置 publicPath 为 "...-{hash}"
else
App->>Config: 使用默认 publicPath
end
Possibly related PRs
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
packages/nutui-taro-demo/config/prod.jsOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the config "taro/react" to extend from. Please check that the name of the config is correct. The config "taro/react" was referenced from the config file in "/packages/nutui-taro-demo/.eslintrc". If you still have problems, please stop by https://eslint.org/chat/help to chat with the team. ✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## feat_v3.x #3137 +/- ##
=============================================
- Coverage 87.09% 87.08% -0.01%
=============================================
Files 280 280
Lines 18535 18535
Branches 2819 2818 -1
=============================================
- Hits 16143 16142 -1
- Misses 2387 2388 +1
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/nutui-taro-demo/config/prod.js (1)
14-15: 考虑移除或调整调试日志这行新增的控制台日志似乎是用于调试目的,显示根据
hash和UI条件拼接的结果。在正式环境的配置中,建议考虑以下几点:
- 如果这是临时调试代码,建议在合并到生产环境前移除
- 如果需要保留作为监控用途,建议添加更明确的日志前缀,例如 "publicPath suffix:"
- 考虑使用条件日志,只在特定环境下输出
-console.log(hash && UI ? `-${hash}` : '') +// 如果需要保留日志,建议使用更明确的日志信息 +console.log(`publicPath suffix: ${hash && UI ? `-${hash}` : ''}`)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/nutui-taro-demo/config/prod.js(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: test
🔇 Additional comments (1)
packages/nutui-taro-demo/config/prod.js (1)
24-24: 修正了 publicPath 的条件拼接逻辑此修改使
publicPath的 hash 拼接逻辑与第 20 行的outputRoot逻辑保持一致,只有当hash和UI都为真时才会附加-${hash}。这解决了正式环境中 publicPath 拼接不一致的问题。确保这种条件判断逻辑符合预期:
- 只有当
hash存在且环境变量UI为真时,才会在路径中添加 hash- 其他情况下使用不带 hash 的路径
Summary by CodeRabbit