Skip to content

Conversation

@fireairforce
Copy link

image

因为 utoopack 需要支持 runtime 的 publicPath, 在 getUrlFromScript 参数为 string 的时候才会去做publicPath url 的拼接

适配一下 PR: vercel#88899

@gemini-code-assist
Copy link

Summary of Changes

Hello @fireairforce, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical issue in Turbopack's runtime asset loading mechanism. By adjusting the parameter passed to getUrlFromScript from a chunk object to a chunkPath string, the change ensures that the publicPath is correctly applied when constructing URLs for runtime chunks. This fix is essential for robust asset resolution and aligns with similar improvements in related projects, specifically to support runtime publicPath where URL splicing requires a string parameter.

Highlights

  • getUrlFromScript Parameter Update: The getUrlFromScript function within the registerChunk method in runtime-backend-dom.ts now receives chunkPath (a string) instead of the chunk object.
  • Enhanced Runtime PublicPath Support: This modification ensures that Turbopack correctly handles runtime publicPath by providing getUrlFromScript with a string parameter, which is essential for proper URL splicing and asset resolution.
Changelog
  • turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/dom/runtime-backend-dom.ts
    • Updated the registerChunk method to pass the chunkPath variable to getUrlFromScript instead of the chunk object, facilitating correct publicPath resolution.
Activity
  • The author fireairforce initiated this pull request to fix a Turbopack issue related to publicPath handling.
  • The pull request description includes an image and references a related Next.js pull request (https://github.com/vercel/next.js/pull/88899) for context and alignment.
  • The author provided a detailed explanation in the description regarding the necessity of this change for runtime publicPath support in Turbopack, specifically noting that URL splicing requires a string parameter for getUrlFromScript.
  • No other review comments or activities have been recorded yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

这个 PR 正确地将传递给 getUrlFromScript 的参数从 chunk 对象更改为 chunk 路径字符串。正如描述中所说,这使得在运行时可以正确地拼接 public path。我还建议了一个小改进,即使用 const 来声明变量,以提高代码质量。

@fireairforce fireairforce merged commit a82d354 into utoo Feb 5, 2026
12 of 25 checks passed
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.

2 participants