-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 EcmascriptChunkUpdate
s before sending them to the client
#3975
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
8 Ignored Deployments
|
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
98226e6
to
670aa30
Compare
041f42e
to
9ec7680
Compare
670aa30
to
5a5db52
Compare
|
1719e4a
to
a08e55b
Compare
9ec7680
to
a2a5e3e
Compare
a08e55b
to
c8c2962
Compare
a2a5e3e
to
10de7af
Compare
9e318d9
to
8338dcd
Compare
let path = chunk.path().await?; | ||
data.push(Value::String(path.path.clone())); | ||
} | ||
let server_root = this.server_root.await?; |
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.
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), |
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.
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. |
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.
This was already the case, but I made it explicit here.
throw new Error(`unknown update type \`${update}\``); | ||
} | ||
}); | ||
} |
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.
CSS updates are now handled at the chunk list level, using the BACKEND.loadChunk/unloadChunk/reloadChunk
logic.
2da7d96
to
f882eb8
Compare
a14da5c
to
19f426a
Compare
f882eb8
to
468c9c9
Compare
19f426a
to
d8142d3
Compare
468c9c9
to
b269366
Compare
d8142d3
to
754ae23
Compare
Benchmark for f907f7f
Click to view full benchmark
|
b269366
to
1f19e84
Compare
Benchmark for 38bc550
Click to view full benchmark
|
crates/next-core/src/next_client_component/with_client_chunks.rs
Outdated
Show resolved
Hide resolved
function __turbopack_load__(path: string): any; | ||
function __turbopack_register_chunk_list__( | ||
chunkListPath: string, | ||
chunksPaths: string[] | ||
): any; |
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.
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.
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.
I think __turbopack_load__
is still useful on its own for loading separate assets which don't have a chunk list.
Benchmark for 91c7ebf
Click to view full benchmark
|
6939aef
to
170319c
Compare
2d20446
to
feee3bd
Compare
Benchmark for 18bfdaa
Click to view full benchmark
|
fd5d61e
to
c48c28f
Compare
c48c28f
to
f183674
Compare
Benchmark for 5aa923b
Click to view full benchmark
|
### 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
# New Features - vercel/turborepo#3975 # Bug Fixes - vercel/turborepo#4129 - vercel/turborepo#4134 - vercel/turborepo#4062 # Performance - vercel/turborepo#4093
…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).
…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).
…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).
### 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
…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).
### 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
…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).
### 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
This diff:
VersionedContentMerger
trait, which allows for merging the updates of versioned contents within the same chunk group;EcmascriptChunkContent
/EcmascriptChunkUpdate
, turning them intoEcmascriptMergedChunkContent
/EcmascriptMergedChunkUpdate
;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:
There are still known edge cases with HMR: