next.js
ff636469 - [turbopack] Simplify JS `ChunkItem` with a single impl in most cases (#89548)

Commit
87 days ago
[turbopack] Simplify JS `ChunkItem` with a single impl in most cases (#89548) # What Removes the vast majority of `ChunkItem` implementations in favour of one `EcmascriptModuleChunkItem`. # Why Almost all of the `ChunkItem` implementations are trivial and were, for the most part, just places where additional traits could be implemented. By removing all of the various, trivial implementations, this might open up opportunities to better implement other features across the entire codebase. # How Most chunk items are migrated over to EcmascriptModuleChunkItem. The EcmascriptChunkPlaceable trait gains three new methods that modules can optionally override: - `chunk_item_content()` - generates the chunk item's JavaScript code - `chunk_item_content_ident()` - returns the content identity for cache invalidation - `chunk_item_output_assets()` - returns output assets the chunk item depends on The generic EcmascriptModuleChunkItem delegates to these trait methods, eliminating the need for per-module wrapper structs.
Author
Parents
Loading