fix(pack): isolate runtime public path for async chunks - #3391
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
A child application can replace globalThis.publicPath after the host runtime starts. Keep the host chunk base in its own runtime and map __webpack_public_path__ assignments to that runtime-local value.
e3fd542 to
d82a7ff
Compare
📊 Performance Benchmark Report (with-antd)Utoopack Performance ReportReport ID: Executive Summary
Build Phase TimelineShows when each build phase is active and how much CPU it consumes.
Workload Distribution by Diagnostic Tier
Top 20 Tasks by Self-TimeSelf-time is the exclusive duration: time spent in the task itself, not in sub-tasks.
Critical Path AnalysisThe longest sequential dependency chains that determine wall-clock time.
Batching CandidatesHigh-volume tasks dominated by a single parent. If the parent can batch them,
Duration Distribution
Action Items
Report generated by Utoopack Performance Analysis Agent |
Summary
__webpack_public_path__reads and assignments.next.jssubmodule to the runtime change in utooland/next.js#195.Cause and fix
With
output.publicPath: "runtime", a child application can overwrite the sharedglobalThis.publicPathafter the host starts. The host previously read that global again when a later tab click loaded an async chunk, so it requested the host chunk from the child's CDN path and received a 404. The runtime now captures its own path at startup. Explicit__webpack_public_path__assignments update that runtime's value without changing the shared global.Compatibility note
This changes observable behavior for applications that intentionally modify
globalThis.publicPathafter the runtime starts to redirect later chunk requests. Set the global path before loading the runtime, or assign__webpack_public_path__in application code to change the current runtime's path. An explicit__webpack_public_path__assignment no longer writesglobalThis.publicPathin any client public-path mode.The
autoand fixed-path modes continue to resolve chunk URLs as before. The__webpack_public_path__read/write transform applies to those modes too, so its global side effect changes there as well. This PR addresses runtime isolation and async chunk URL behavior; it does not claim full Webpack public-path equivalence across all modes.Verification
https://child.example/assets/...for the host's first async chunk.cargo test -p pack-tests --test snapshot -- --quietpassed: 149/149.cargo fmt --checkandcargo clippy --all-targets -- -D warnings --no-depspassed.The
next.jssubmodule now points to the merged utooland/next.js#195 commit (c1985d56d518f1c930f7fc5d7307e0eecaa5d453).