forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 1
[pull] canary from vercel:canary #739
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
Conversation
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
Rename to reflect what this property actually means
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # --> > [!NOTE] > This PR only includes documentation updates and has no impact on runtime behavior. ### What? Just fixed typos in docs. ### How? - `direcly` → `directly` - `existance` → `existence` - `overriden` → `overridden`
…oader mapping (#88775) ## What? Fixes a bug where `react-loadable-manifest.json` in Turbopack dev mode contained references to chunk files with wrong hashes, causing 404 errors when loading dynamic imports. ## Why? When using `next/dynamic` with nested imports (e.g., a dynamic component that itself imports other modules), the chunk files referenced in `react-loadable-manifest.json` had different hashes than the actual generated chunk files. The root cause was that `collect_next_dynamic_chunks` was **recomputing** chunk content that was already computed by `make_chunk_group`. This pattern was inherently brittle because Next.js code had to carefully mirror Turbopack's internal chunking logic to get consistent hashes. This brittleness was exposed when the `turbopackClientSideNestedAsyncChunking` feature was disabled in dev mode (released in 16.1). The subtle differences in how availability info was computed led to hash mismatches. ## How? Instead of recomputing chunks for next/dynamic imports, this PR preserves the module→async loader mapping from when chunks are first computed in `make_chunk_group`, and looks up pre-computed chunks directly. This eliminates the need for Next.js to replicate Turbopack's chunking logic. ### Key changes: 1. **Extended `MakeChunkGroupResult` and `ChunkGroupResult`** with `async_loaders_by_module` field - Maps `ResolvedVc<Box<dyn ChunkableModule>>` → `ResolvedVc<Box<dyn ChunkItem>>` - Preserves the module→loader relationship computed during chunking 2. **Eliminated redundancy** in `MakeChunkGroupResult` - Removed the separate `references` field (was just upcasted async loaders) - Added `references()` method that derives references on-demand from the map 3. **Simplified `collect_next_dynamic_chunks`** - Now performs simple lookup instead of recomputation - Removed `module_graph` and `chunking_context` parameters - Uses `NextDynamicChunkAvailability` enum to access pre-computed chunk groups 4. **Added regression test** to verify chunk files referenced in manifest exist ### Files modified: - `turbopack/crates/turbopack-core/src/chunk/chunk_group.rs` - Add mapping, remove redundant field - `turbopack/crates/turbopack-core/src/chunk/chunking_context.rs` - Extend ChunkGroupResult - `turbopack/crates/turbopack-browser/src/chunking_context.rs` - Pass through mapping - `turbopack/crates/turbopack-nodejs/src/chunking_context.rs` - Pass through mapping - `crates/next-api/src/dynamic_imports.rs` - Lookup instead of recompute - `crates/next-api/src/pages.rs` - Updated caller - `crates/next-api/src/app.rs` - Updated caller - `crates/next-core/src/next_app/app_client_references_chunks.rs` - Initialize empty map Fixes #87680
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )