Skip to content
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

Merge EcmascriptChunkUpdates before sending them to the client #3975

Merged
merged 1 commit into from
Mar 9, 2023

Conversation

alexkirsz
Copy link
Contributor

@alexkirsz alexkirsz commented Feb 27, 2023

This diff:

  • introduces the VersionedContentMerger trait, which allows for merging the updates of versioned contents within the same chunk group;
  • implements this for EcmascriptChunkContent/EcmascriptChunkUpdate, turning them into EcmascriptMergedChunkContent/EcmascriptMergedChunkUpdate;
  • creates a new ChunkList asset which is capable of merging chunk updates of chunks within the same chunk group, and create such an asset for dynamic chunks (through manifest/loader_item.rs) and chunk group files assets.

This fixes a bunch of edge cases related to HMR:

  • HMR of dynamic imports now works;
  • Chunks getting added/deleted/renamed now also works with HMR, since we're listening to updates at the chunk group level;
  • CSS chunks get reloaded in the right order, with respect for precedence.

There are still known edge cases with HMR:

  • CSS chunks added through HMR are not inserted at the right position to respect precedence (WEB-652).
  • Update aggregation is disabled because we don't want a critical issue to stop all HMR (WEB-582) . This would be fixed by applying aggregated updates when dismissing the error modal, but there are some edge cases with this too (e.g. what happens when an HMR update also causes an error on top of an existing error).

@vercel
Copy link

vercel bot commented Feb 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
examples-nonmonorepo 🔄 Building (Inspect) Mar 9, 2023 at 10:58AM (UTC)
examples-vite-web 🔄 Building (Inspect) Mar 9, 2023 at 10:58AM (UTC)
8 Ignored Deployments
Name Status Preview Comments Updated
examples-basic-web ⬜️ Ignored (Inspect) Mar 9, 2023 at 10:58AM (UTC)
examples-cra-web ⬜️ Ignored (Inspect) Mar 9, 2023 at 10:58AM (UTC)
examples-designsystem-docs ⬜️ Ignored (Inspect) Mar 9, 2023 at 10:58AM (UTC)
examples-kitchensink-blog ⬜️ Ignored (Inspect) Mar 9, 2023 at 10:58AM (UTC)
examples-native-web ⬜️ Ignored (Inspect) Mar 9, 2023 at 10:58AM (UTC)
examples-svelte-web ⬜️ Ignored (Inspect) Mar 9, 2023 at 10:58AM (UTC)
examples-tailwind-web ⬜️ Ignored (Inspect) Mar 9, 2023 at 10:58AM (UTC)
turbo-site ⬜️ Ignored (Inspect) Visit Preview Mar 9, 2023 at 10:58AM (UTC)

@alexkirsz
Copy link
Contributor Author

alexkirsz commented Feb 27, 2023

@alexkirsz alexkirsz force-pushed the alexkirsz/web-616-merged-updates branch from 98226e6 to 670aa30 Compare February 27, 2023 12:28
@alexkirsz alexkirsz force-pushed the alexkirsz/web-616-split-ecmascript-modules branch from 041f42e to 9ec7680 Compare February 27, 2023 12:34
@alexkirsz alexkirsz force-pushed the alexkirsz/web-616-merged-updates branch from 670aa30 to 5a5db52 Compare February 27, 2023 12:35
@github-actions
Copy link
Contributor

github-actions bot commented Feb 27, 2023

⚠️ CI failed ⚠️

The following steps have failed in CI:

  • Turbopack Rust tests (mac/win, non-blocking)

See workflow summary for details

@alexkirsz alexkirsz force-pushed the alexkirsz/web-616-merged-updates branch 2 times, most recently from 1719e4a to a08e55b Compare February 27, 2023 14:54
@alexkirsz alexkirsz marked this pull request as ready for review February 27, 2023 14:59
@alexkirsz alexkirsz requested a review from a team as a code owner February 27, 2023 14:59
@alexkirsz alexkirsz force-pushed the alexkirsz/web-616-split-ecmascript-modules branch from 9ec7680 to a2a5e3e Compare February 27, 2023 15:06
@alexkirsz alexkirsz force-pushed the alexkirsz/web-616-merged-updates branch from a08e55b to c8c2962 Compare February 27, 2023 15:06
@alexkirsz alexkirsz force-pushed the alexkirsz/web-616-split-ecmascript-modules branch from a2a5e3e to 10de7af Compare February 27, 2023 15:24
@alexkirsz alexkirsz changed the base branch from alexkirsz/web-616-split-ecmascript-modules to alexkirsz/web-616-remove-cell_local-in-favor-of-more February 27, 2023 15:25
@alexkirsz alexkirsz force-pushed the alexkirsz/web-616-merged-updates branch 2 times, most recently from 9e318d9 to 8338dcd Compare February 27, 2023 15:27
let path = chunk.path().await?;
data.push(Value::String(path.path.clone()));
}
let server_root = this.server_root.await?;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The way the page loader asset computed paths was incorrect before, as it wasn't basing them upon the server root path. But this doesn't really have any measurable effect today as we don't support base path.

location.reload();
aggregated = {
resource: msg.resource,
update: mergeChunkListUpdates(aggregated.update, msg.instruction),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the HMR updates are now very different (from a simple "EcmascriptChunkUpdate" to a "ChunkListUpdate" that can contain simple chunk updates and complex "EcmascriptMergedChunkUpdate"s), I cut the merging logic into smaller functions that each operate at a specific nested-type's level.


const runHooks = chunksWithUpdates.size === 0;
// TODO(WEB-582) Disable update aggregation for now.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was already the case, but I made it explicit here.

throw new Error(`unknown update type \`${update}\``);
}
});
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

CSS updates are now handled at the chunk list level, using the BACKEND.loadChunk/unloadChunk/reloadChunk logic.

@alexkirsz alexkirsz force-pushed the alexkirsz/web-616-remove-cell_local-in-favor-of-more branch from 2da7d96 to f882eb8 Compare February 28, 2023 09:25
@alexkirsz alexkirsz force-pushed the alexkirsz/web-616-merged-updates branch from a14da5c to 19f426a Compare February 28, 2023 09:25
@alexkirsz alexkirsz force-pushed the alexkirsz/web-616-remove-cell_local-in-favor-of-more branch from f882eb8 to 468c9c9 Compare February 28, 2023 09:35
@alexkirsz alexkirsz force-pushed the alexkirsz/web-616-merged-updates branch from 19f426a to d8142d3 Compare February 28, 2023 09:35
@alexkirsz alexkirsz force-pushed the alexkirsz/web-616-remove-cell_local-in-favor-of-more branch from 468c9c9 to b269366 Compare February 28, 2023 09:55
@alexkirsz alexkirsz force-pushed the alexkirsz/web-616-merged-updates branch from d8142d3 to 754ae23 Compare February 28, 2023 09:55
@github-actions
Copy link
Contributor

Benchmark for f907f7f

Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 11.59ms ± 0.04ms N/A N/A N/A
bench_hmr_to_commit/Turbopack RCC/1000 modules 14.45ms ± 0.26ms N/A N/A N/A
bench_hmr_to_commit/Turbopack SSR/1000 modules 11.40ms ± 0.08ms 14.80ms ± 0.18ms +29.79% +24.89%
bench_hmr_to_eval/Turbopack CSR/1000 modules 10.56ms ± 0.09ms N/A N/A N/A
bench_hmr_to_eval/Turbopack RCC/1000 modules 13.40ms ± 0.28ms N/A N/A N/A
bench_hmr_to_eval/Turbopack SSR/1000 modules 10.53ms ± 0.11ms 13.80ms ± 0.15ms +30.98% +25.38%
bench_hydration/Turbopack RCC/1000 modules 3937.30ms ± 18.78ms 3884.94ms ± 6.19ms -1.33% -0.06%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 11.59ms ± 0.04ms N/A N/A N/A
bench_hmr_to_commit/Turbopack RCC/1000 modules 14.45ms ± 0.26ms N/A N/A N/A
bench_hmr_to_commit/Turbopack RSC/1000 modules 524.37ms ± 1.13ms 519.25ms ± 2.38ms -0.98%
bench_hmr_to_commit/Turbopack SSR/1000 modules 11.40ms ± 0.08ms 14.80ms ± 0.18ms +29.79% +24.89%
bench_hmr_to_eval/Turbopack CSR/1000 modules 10.56ms ± 0.09ms N/A N/A N/A
bench_hmr_to_eval/Turbopack RCC/1000 modules 13.40ms ± 0.28ms N/A N/A N/A
bench_hmr_to_eval/Turbopack SSR/1000 modules 10.53ms ± 0.11ms 13.80ms ± 0.15ms +30.98% +25.38%
bench_hydration/Turbopack RCC/1000 modules 3937.30ms ± 18.78ms 3884.94ms ± 6.19ms -1.33% -0.06%
bench_hydration/Turbopack RSC/1000 modules 3543.90ms ± 16.58ms 3541.96ms ± 14.66ms -0.05%
bench_hydration/Turbopack SSR/1000 modules 3409.91ms ± 9.96ms 3403.31ms ± 9.06ms -0.19%
bench_startup/Turbopack CSR/1000 modules 2617.43ms ± 5.20ms 2600.83ms ± 6.06ms -0.63%
bench_startup/Turbopack RCC/1000 modules 2395.59ms ± 5.97ms 2403.99ms ± 8.82ms +0.35%
bench_startup/Turbopack RSC/1000 modules 2353.87ms ± 10.95ms 2347.25ms ± 9.37ms -0.28%
bench_startup/Turbopack SSR/1000 modules 2097.45ms ± 3.46ms 2099.46ms ± 3.32ms +0.10%

@alexkirsz alexkirsz force-pushed the alexkirsz/web-616-remove-cell_local-in-favor-of-more branch from b269366 to 1f19e84 Compare February 28, 2023 11:56
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2023

Benchmark for 38bc550

Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 9096.79µs ± 42.63µs 11.00ms ± 0.04ms +20.93% +18.98%
bench_hmr_to_commit/Turbopack RCC/1000 modules 12.85ms ± 0.11ms 14.34ms ± 0.21ms +11.59% +6.47%
bench_hmr_to_commit/Turbopack RSC/1000 modules 492.30ms ± 0.68ms 497.48ms ± 1.88ms +1.05% +0.01%
bench_hmr_to_commit/Turbopack SSR/1000 modules 9311.60µs ± 63.37µs 11.26ms ± 0.04ms +20.89% +18.34%
bench_hmr_to_eval/Turbopack CSR/1000 modules 8134.12µs ± 20.37µs 10.08ms ± 0.04ms +23.87% +22.22%
bench_hmr_to_eval/Turbopack RCC/1000 modules 12.07ms ± 0.12ms 12.92ms ± 0.11ms +7.06% +3.21%
bench_hmr_to_eval/Turbopack SSR/1000 modules 8328.61µs ± 31.07µs 10.29ms ± 0.04ms +23.55% +21.77%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 9096.79µs ± 42.63µs 11.00ms ± 0.04ms +20.93% +18.98%
bench_hmr_to_commit/Turbopack RCC/1000 modules 12.85ms ± 0.11ms 14.34ms ± 0.21ms +11.59% +6.47%
bench_hmr_to_commit/Turbopack RSC/1000 modules 492.30ms ± 0.68ms 497.48ms ± 1.88ms +1.05% +0.01%
bench_hmr_to_commit/Turbopack SSR/1000 modules 9311.60µs ± 63.37µs 11.26ms ± 0.04ms +20.89% +18.34%
bench_hmr_to_eval/Turbopack CSR/1000 modules 8134.12µs ± 20.37µs 10.08ms ± 0.04ms +23.87% +22.22%
bench_hmr_to_eval/Turbopack RCC/1000 modules 12.07ms ± 0.12ms 12.92ms ± 0.11ms +7.06% +3.21%
bench_hmr_to_eval/Turbopack SSR/1000 modules 8328.61µs ± 31.07µs 10.29ms ± 0.04ms +23.55% +21.77%
bench_hydration/Turbopack RCC/1000 modules 3594.13ms ± 10.63ms 3589.35ms ± 5.92ms -0.13%
bench_hydration/Turbopack RSC/1000 modules 3237.72ms ± 8.66ms 3238.00ms ± 12.60ms +0.01%
bench_hydration/Turbopack SSR/1000 modules 3298.75ms ± 5.92ms 3319.83ms ± 11.29ms +0.64%
bench_startup/Turbopack CSR/1000 modules 2588.56ms ± 5.18ms 2568.48ms ± 5.87ms -0.78%
bench_startup/Turbopack RCC/1000 modules 2117.74ms ± 3.33ms 2120.54ms ± 3.25ms +0.13%
bench_startup/Turbopack RSC/1000 modules 2051.20ms ± 5.87ms 2051.83ms ± 9.60ms +0.03%
bench_startup/Turbopack SSR/1000 modules 2037.02ms ± 1.77ms 2042.11ms ± 3.15ms +0.25%

crates/next-core/js/src/entry/app/server-to-client-ssr.tsx Outdated Show resolved Hide resolved
crates/next-core/js/src/entry/app/hydrate.tsx Outdated Show resolved Hide resolved
Comment on lines 3 to +7
function __turbopack_load__(path: string): any;
function __turbopack_register_chunk_list__(
chunkListPath: string,
chunksPaths: string[]
): any;
Copy link
Member

Choose a reason for hiding this comment

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

should we merge these and offer a single method:

function __turbopack_load_chunks__(
    chunkPaths: string[]
    chunkListPath: string,
  ): any;

which loads all the chunks at once and registers the chunk list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think __turbopack_load__ is still useful on its own for loading separate assets which don't have a chunk list.

crates/next-core/src/web_entry_source.rs Outdated Show resolved Hide resolved
crates/turbopack-ecmascript/src/chunk/mod.rs Outdated Show resolved Hide resolved
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

Benchmark for 91c7ebf

Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 9101.23µs ± 41.17µs 9751.61µs ± 24.46µs +7.15% +5.65%
bench_hmr_to_commit/Turbopack SSR/1000 modules 9427.19µs ± 18.32µs 9967.84µs ± 54.82µs +5.73% +4.17%
bench_hmr_to_eval/Turbopack CSR/1000 modules 8105.37µs ± 44.92µs 8738.37µs ± 30.46µs +7.81% +5.88%
bench_hmr_to_eval/Turbopack SSR/1000 modules 8211.79µs ± 42.48µs 8858.81µs ± 69.21µs +7.88% +5.11%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 9101.23µs ± 41.17µs 9751.61µs ± 24.46µs +7.15% +5.65%
bench_hmr_to_commit/Turbopack RCC/1000 modules 13.09ms ± 0.08ms 12.85ms ± 0.24ms -1.86%
bench_hmr_to_commit/Turbopack RSC/1000 modules 497.20ms ± 0.49ms 499.63ms ± 1.82ms +0.49%
bench_hmr_to_commit/Turbopack SSR/1000 modules 9427.19µs ± 18.32µs 9967.84µs ± 54.82µs +5.73% +4.17%
bench_hmr_to_eval/Turbopack CSR/1000 modules 8105.37µs ± 44.92µs 8738.37µs ± 30.46µs +7.81% +5.88%
bench_hmr_to_eval/Turbopack RCC/1000 modules 11.43ms ± 0.21ms 11.65ms ± 0.26ms +1.99%
bench_hmr_to_eval/Turbopack SSR/1000 modules 8211.79µs ± 42.48µs 8858.81µs ± 69.21µs +7.88% +5.11%
bench_hydration/Turbopack RCC/1000 modules 3588.61ms ± 9.16ms 3595.23ms ± 11.76ms +0.18%
bench_hydration/Turbopack RSC/1000 modules 3211.96ms ± 11.99ms 3215.17ms ± 12.46ms +0.10%
bench_hydration/Turbopack SSR/1000 modules 3275.16ms ± 5.74ms 3279.11ms ± 6.24ms +0.12%
bench_startup/Turbopack CSR/1000 modules 2557.85ms ± 4.82ms 2575.01ms ± 11.16ms +0.67%
bench_startup/Turbopack RCC/1000 modules 2110.82ms ± 4.40ms 2124.88ms ± 5.99ms +0.67%
bench_startup/Turbopack RSC/1000 modules 2039.04ms ± 7.60ms 2046.95ms ± 7.52ms +0.39%
bench_startup/Turbopack SSR/1000 modules 2041.44ms ± 5.50ms 2030.14ms ± 3.85ms -0.55%

@alexkirsz alexkirsz force-pushed the alexkirsz/web-616-remove-cell_local-in-favor-of-more branch from 6939aef to 170319c Compare March 8, 2023 17:31
@alexkirsz alexkirsz force-pushed the alexkirsz/web-616-merged-updates branch from 2d20446 to feee3bd Compare March 8, 2023 17:31
Base automatically changed from alexkirsz/web-616-remove-cell_local-in-favor-of-more to main March 8, 2023 17:55
@alexkirsz alexkirsz requested a review from sokra March 8, 2023 17:56
@alexkirsz alexkirsz added the pr: automerge Kodiak will merge these automatically after checks pass label Mar 8, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

Benchmark for 18bfdaa

Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 9607.07µs ± 45.19µs 10.29ms ± 0.05ms +7.08% +5.14%
bench_hmr_to_commit/Turbopack SSR/1000 modules 9655.23µs ± 58.61µs 10.48ms ± 0.04ms +8.50% +6.35%
bench_hmr_to_eval/Turbopack CSR/1000 modules 8471.87µs ± 32.24µs 9403.08µs ± 43.05µs +10.99% +9.14%
bench_hmr_to_eval/Turbopack SSR/1000 modules 8641.12µs ± 37.64µs 9414.80µs ± 70.06µs +8.95% +6.40%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 9607.07µs ± 45.19µs 10.29ms ± 0.05ms +7.08% +5.14%
bench_hmr_to_commit/Turbopack RCC/1000 modules 12.34ms ± 0.20ms 12.37ms ± 0.11ms +0.26%
bench_hmr_to_commit/Turbopack RSC/1000 modules 502.32ms ± 1.22ms 505.24ms ± 1.39ms +0.58%
bench_hmr_to_commit/Turbopack SSR/1000 modules 9655.23µs ± 58.61µs 10.48ms ± 0.04ms +8.50% +6.35%
bench_hmr_to_eval/Turbopack CSR/1000 modules 8471.87µs ± 32.24µs 9403.08µs ± 43.05µs +10.99% +9.14%
bench_hmr_to_eval/Turbopack RCC/1000 modules 10.51ms ± 0.11ms 10.87ms ± 0.07ms +3.37%
bench_hmr_to_eval/Turbopack SSR/1000 modules 8641.12µs ± 37.64µs 9414.80µs ± 70.06µs +8.95% +6.40%
bench_hydration/Turbopack RCC/1000 modules 3487.14ms ± 11.11ms 3485.13ms ± 8.89ms -0.06%
bench_hydration/Turbopack RSC/1000 modules 3166.47ms ± 14.86ms 3174.22ms ± 8.22ms +0.24%
bench_hydration/Turbopack SSR/1000 modules 3290.77ms ± 7.67ms 3293.94ms ± 5.91ms +0.10%
bench_startup/Turbopack CSR/1000 modules 2584.30ms ± 4.63ms 2588.92ms ± 9.22ms +0.18%
bench_startup/Turbopack RCC/1000 modules 1989.55ms ± 3.28ms 1984.97ms ± 2.49ms -0.23%
bench_startup/Turbopack RSC/1000 modules 1966.60ms ± 4.12ms 1971.15ms ± 4.37ms +0.23%
bench_startup/Turbopack SSR/1000 modules 2024.91ms ± 2.15ms 2031.65ms ± 2.96ms +0.33%

@alexkirsz alexkirsz force-pushed the alexkirsz/web-616-merged-updates branch from fd5d61e to c48c28f Compare March 9, 2023 10:31
@alexkirsz alexkirsz force-pushed the alexkirsz/web-616-merged-updates branch from c48c28f to f183674 Compare March 9, 2023 10:58
@kodiakhq kodiakhq bot merged commit 8521605 into main Mar 9, 2023
@kodiakhq kodiakhq bot deleted the alexkirsz/web-616-merged-updates branch March 9, 2023 11:13
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2023

Benchmark for 5aa923b

Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 9178.52µs ± 45.26µs 9991.58µs ± 45.83µs +8.86% +6.81%
bench_hmr_to_commit/Turbopack SSR/1000 modules 9565.30µs ± 90.59µs 10.15ms ± 0.06ms +6.07% +2.82%
bench_hmr_to_eval/Turbopack CSR/1000 modules 8177.23µs ± 46.75µs 9071.25µs ± 107.65µs +10.93% +7.08%
bench_hmr_to_eval/Turbopack SSR/1000 modules 8282.24µs ± 26.19µs 9173.82µs ± 25.59µs +10.76% +9.45%
bench_startup/Turbopack RCC/1000 modules 1983.59ms ± 2.96ms 2001.15ms ± 1.96ms +0.89% +0.39%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 9178.52µs ± 45.26µs 9991.58µs ± 45.83µs +8.86% +6.81%
bench_hmr_to_commit/Turbopack RCC/1000 modules 11.93ms ± 0.10ms 11.93ms ± 0.21ms +0.04%
bench_hmr_to_commit/Turbopack RSC/1000 modules 510.22ms ± 2.39ms 517.17ms ± 2.34ms +1.36%
bench_hmr_to_commit/Turbopack SSR/1000 modules 9565.30µs ± 90.59µs 10.15ms ± 0.06ms +6.07% +2.82%
bench_hmr_to_eval/Turbopack CSR/1000 modules 8177.23µs ± 46.75µs 9071.25µs ± 107.65µs +10.93% +7.08%
bench_hmr_to_eval/Turbopack RCC/1000 modules 10.04ms ± 0.15ms 10.30ms ± 0.16ms +2.56%
bench_hmr_to_eval/Turbopack SSR/1000 modules 8282.24µs ± 26.19µs 9173.82µs ± 25.59µs +10.76% +9.45%
bench_hydration/Turbopack RCC/1000 modules 3461.15ms ± 10.55ms 3469.80ms ± 12.21ms +0.25%
bench_hydration/Turbopack RSC/1000 modules 3156.57ms ± 11.64ms 3159.30ms ± 11.09ms +0.09%
bench_hydration/Turbopack SSR/1000 modules 3268.78ms ± 5.61ms 3273.81ms ± 5.21ms +0.15%
bench_startup/Turbopack CSR/1000 modules 2574.23ms ± 6.87ms 2568.60ms ± 7.37ms -0.22%
bench_startup/Turbopack RCC/1000 modules 1983.59ms ± 2.96ms 2001.15ms ± 1.96ms +0.89% +0.39%
bench_startup/Turbopack RSC/1000 modules 1973.31ms ± 3.39ms 1989.87ms ± 7.26ms +0.84%
bench_startup/Turbopack SSR/1000 modules 2029.37ms ± 7.86ms 2023.66ms ± 3.73ms -0.28%

kodiakhq bot pushed a commit that referenced this pull request Mar 9, 2023
### Description

It's a bit ugly and I dislike the way it's implemented, but this will
help for now.

* When using HMR and introducing an parse error to a module, this keeps
the previous references and exports type to keep the environment intact
and avoid unloading a bunch of modules

depends on #3975 to work correctly
ijjk pushed a commit to vercel/next.js that referenced this pull request Mar 9, 2023
jridgewell pushed a commit to vercel/next.js that referenced this pull request Mar 10, 2023
…cel/turborepo#3975)

This diff:
* introduces the `VersionedContentMerger` trait, which allows for
merging the updates of versioned contents within the same chunk group;
* implements this for `EcmascriptChunkContent`/`EcmascriptChunkUpdate`,
turning them into
`EcmascriptMergedChunkContent`/`EcmascriptMergedChunkUpdate`;
* creates a new `ChunkList` asset which is capable of merging chunk
updates of chunks within the same chunk group, and create such an asset
for dynamic chunks (through manifest/loader_item.rs) and chunk group
files assets.

This fixes a bunch of edge cases related to HMR:
* HMR of dynamic imports now works;
* Chunks getting added/deleted/renamed now also works with HMR, since
we're listening to updates at the chunk group level;
* CSS chunks get reloaded in the right order, with respect for
precedence.

There are still known edge cases with HMR:
* CSS chunks added through HMR are not inserted at the right position to
respect precedence (WEB-652).
* Update aggregation is disabled because we don't want a critical issue
to stop all HMR (WEB-582) . This would be fixed by applying aggregated
updates when dismissing the error modal, but there are some edge cases
with this too (e.g. what happens when an HMR update also causes an error
on top of an existing error).
sokra pushed a commit to vercel/next.js that referenced this pull request Mar 13, 2023
…cel/turborepo#3975)

This diff:
* introduces the `VersionedContentMerger` trait, which allows for
merging the updates of versioned contents within the same chunk group;
* implements this for `EcmascriptChunkContent`/`EcmascriptChunkUpdate`,
turning them into
`EcmascriptMergedChunkContent`/`EcmascriptMergedChunkUpdate`;
* creates a new `ChunkList` asset which is capable of merging chunk
updates of chunks within the same chunk group, and create such an asset
for dynamic chunks (through manifest/loader_item.rs) and chunk group
files assets.

This fixes a bunch of edge cases related to HMR:
* HMR of dynamic imports now works;
* Chunks getting added/deleted/renamed now also works with HMR, since
we're listening to updates at the chunk group level;
* CSS chunks get reloaded in the right order, with respect for
precedence.

There are still known edge cases with HMR:
* CSS chunks added through HMR are not inserted at the right position to
respect precedence (WEB-652).
* Update aggregation is disabled because we don't want a critical issue
to stop all HMR (WEB-582) . This would be fixed by applying aggregated
updates when dismissing the error modal, but there are some edge cases
with this too (e.g. what happens when an HMR update also causes an error
on top of an existing error).
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 25, 2024
…cel/turborepo#3975)

This diff:
* introduces the `VersionedContentMerger` trait, which allows for
merging the updates of versioned contents within the same chunk group;
* implements this for `EcmascriptChunkContent`/`EcmascriptChunkUpdate`,
turning them into
`EcmascriptMergedChunkContent`/`EcmascriptMergedChunkUpdate`;
* creates a new `ChunkList` asset which is capable of merging chunk
updates of chunks within the same chunk group, and create such an asset
for dynamic chunks (through manifest/loader_item.rs) and chunk group
files assets.

This fixes a bunch of edge cases related to HMR:
* HMR of dynamic imports now works;
* Chunks getting added/deleted/renamed now also works with HMR, since
we're listening to updates at the chunk group level;
* CSS chunks get reloaded in the right order, with respect for
precedence.

There are still known edge cases with HMR:
* CSS chunks added through HMR are not inserted at the right position to
respect precedence (WEB-652).
* Update aggregation is disabled because we don't want a critical issue
to stop all HMR (WEB-582) . This would be fixed by applying aggregated
updates when dismissing the error modal, but there are some edge cases
with this too (e.g. what happens when an HMR update also causes an error
on top of an existing error).
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 25, 2024
### Description

It's a bit ugly and I dislike the way it's implemented, but this will
help for now.

* When using HMR and introducing an parse error to a module, this keeps
the previous references and exports type to keep the environment intact
and avoid unloading a bunch of modules

depends on vercel/turborepo#3975 to work correctly
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
…cel/turborepo#3975)

This diff:
* introduces the `VersionedContentMerger` trait, which allows for
merging the updates of versioned contents within the same chunk group;
* implements this for `EcmascriptChunkContent`/`EcmascriptChunkUpdate`,
turning them into
`EcmascriptMergedChunkContent`/`EcmascriptMergedChunkUpdate`;
* creates a new `ChunkList` asset which is capable of merging chunk
updates of chunks within the same chunk group, and create such an asset
for dynamic chunks (through manifest/loader_item.rs) and chunk group
files assets.

This fixes a bunch of edge cases related to HMR:
* HMR of dynamic imports now works;
* Chunks getting added/deleted/renamed now also works with HMR, since
we're listening to updates at the chunk group level;
* CSS chunks get reloaded in the right order, with respect for
precedence.

There are still known edge cases with HMR:
* CSS chunks added through HMR are not inserted at the right position to
respect precedence (WEB-652).
* Update aggregation is disabled because we don't want a critical issue
to stop all HMR (WEB-582) . This would be fixed by applying aggregated
updates when dismissing the error modal, but there are some edge cases
with this too (e.g. what happens when an HMR update also causes an error
on top of an existing error).
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
### Description

It's a bit ugly and I dislike the way it's implemented, but this will
help for now.

* When using HMR and introducing an parse error to a module, this keeps
the previous references and exports type to keep the environment intact
and avoid unloading a bunch of modules

depends on vercel/turborepo#3975 to work correctly
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
…cel/turborepo#3975)

This diff:
* introduces the `VersionedContentMerger` trait, which allows for
merging the updates of versioned contents within the same chunk group;
* implements this for `EcmascriptChunkContent`/`EcmascriptChunkUpdate`,
turning them into
`EcmascriptMergedChunkContent`/`EcmascriptMergedChunkUpdate`;
* creates a new `ChunkList` asset which is capable of merging chunk
updates of chunks within the same chunk group, and create such an asset
for dynamic chunks (through manifest/loader_item.rs) and chunk group
files assets.

This fixes a bunch of edge cases related to HMR:
* HMR of dynamic imports now works;
* Chunks getting added/deleted/renamed now also works with HMR, since
we're listening to updates at the chunk group level;
* CSS chunks get reloaded in the right order, with respect for
precedence.

There are still known edge cases with HMR:
* CSS chunks added through HMR are not inserted at the right position to
respect precedence (WEB-652).
* Update aggregation is disabled because we don't want a critical issue
to stop all HMR (WEB-582) . This would be fixed by applying aggregated
updates when dismissing the error modal, but there are some edge cases
with this too (e.g. what happens when an HMR update also causes an error
on top of an existing error).
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
### Description

It's a bit ugly and I dislike the way it's implemented, but this will
help for now.

* When using HMR and introducing an parse error to a module, this keeps
the previous references and exports type to keep the environment intact
and avoid unloading a bunch of modules

depends on vercel/turborepo#3975 to work correctly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: automerge Kodiak will merge these automatically after checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants