-
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
Chunking Context Refactor pt. 3: Address PR comments from pt. 2 #4546
Chunking Context Refactor pt. 3: Address PR comments from pt. 2 #4546
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
8 Ignored Deployments
|
✅ This changes can build |
🟢 CI successful 🟢Thanks |
2ed14e8
to
e8830f3
Compare
optimize_ecmascript_chunks(EcmascriptChunksVc::cell(ecmascript_chunks)).await?; | ||
let css_chunks = optimize_css_chunks(CssChunksVc::cell(css_chunks)).await?; | ||
|
||
let chunks = ecmascript_chunks |
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 creates an explicit order between JS and CSS chunks in the output asset list, which causes the changes in snapshots.
#[turbo_tasks::value_trait] | ||
pub trait OptimizableChunk: Chunk + Asset { | ||
fn get_optimizer(&self) -> ChunkOptimizerVc; | ||
} |
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 is no longer relevant, as the chunking context has to know about all the different chunk types it can handle anyway. So instead of the chunks themselves implementing this trait, it's the chunking context which resolves chunks to particular types, and optimizes them accordingly.
} | ||
|
||
fn skip_unnessary_nodes<T>(trees: &mut IndexMap<FileSystemPathVc, Rc<RefCell<Node<T>>>>) { | ||
for tree in trees.values_mut() { |
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.
values_mut
is a bit confusing.
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 was checking if let mut tree = tree.get_mut()
will work at the line below
@@ -0,0 +1,220 @@ | |||
use std::{cell::RefCell, mem::take, rc::Rc}; |
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 extracted from turbopack_core::chunk::optimize
. The only difference is that the tree now operates on a generic T
type instead of ChunkVc
.
e8830f3
to
92f5e52
Compare
Benchmark for 33edc64Click to view benchmark
|
### What? gives user code access to `process.env.PORT` as current server port avoid injecting env vars into code on server ### Why? it might need construct an addr to fetch from api routes fixes WEB-868 ### Turbopack changes * vercel/turborepo#4565 <!-- Tobias Koppers - Bind to IPv6 and IPv4 --> * vercel/turborepo#4570 <!-- Tobias Koppers - review follow ups --> * vercel/turborepo#4585 <!-- Tobias Koppers - fixup bind v6 PR: add missing listen call --> * ~vercel/turborepo#4546 <!-- Alex Kirszenberg - Chunking Context Refactor pt. 3: Address PR comments from pt. 2 --> * vercel/turborepo#4580 <!-- Tobias Koppers - remove circular dependency --> * vercel/turborepo#4582 <!-- Tobias Koppers - ignore internal and server-relative url() in CSS --> * vercel/turborepo#4579 <!-- Tobias Koppers - make node bootstrap asset lazy --> * vercel/turborepo#4581 <!-- Tobias Koppers - allow to create stress test for client components --> * vercel/turborepo#4584 <!-- Tobias Koppers - improve node.js receive timeout --> * vercel/turborepo#4583 <!-- Tobias Koppers - remove panic since this might happen due to eventual consistency --> fixes WEB-871
See #4546 for the first attempt. This causes Next.js tests to fail. ~~Currently figuring out what's wrong.~~ This surfaced an existing issue in our chunk optimization logic, where chunks of different chunking contexts (SSR and RSC) would be merged together, leading to invalid module ids. link WEB-891
…el#4546) ### Description This PR does two things, addressing related comments from vercel#4450: 1. Replace `ChunkReferenceVc` and `ParallelChunkReferenceVc` with `Chunk::parallel_chunks`. 2. Moves all non-generic optimization logic out of `turbopack-core` and into `turbopack-dev`. These optimization methods are very specific to a development environment, and `turbopack-build` will have different ones. ### Testing Instructions Snapshots link WEB-891
…el#4601) See vercel#4546 for the first attempt. This causes Next.js tests to fail. ~~Currently figuring out what's wrong.~~ This surfaced an existing issue in our chunk optimization logic, where chunks of different chunking contexts (SSR and RSC) would be merged together, leading to invalid module ids. link WEB-891
…el/turborepo#4546) ### Description This PR does two things, addressing related comments from vercel/turborepo#4450: 1. Replace `ChunkReferenceVc` and `ParallelChunkReferenceVc` with `Chunk::parallel_chunks`. 2. Moves all non-generic optimization logic out of `turbopack-core` and into `turbopack-dev`. These optimization methods are very specific to a development environment, and `turbopack-build` will have different ones. ### Testing Instructions Snapshots link WEB-891
…el/turborepo#4601) See vercel/turborepo#4546 for the first attempt. This causes Next.js tests to fail. ~~Currently figuring out what's wrong.~~ This surfaced an existing issue in our chunk optimization logic, where chunks of different chunking contexts (SSR and RSC) would be merged together, leading to invalid module ids. link WEB-891
…el/turborepo#4546) ### Description This PR does two things, addressing related comments from vercel/turborepo#4450: 1. Replace `ChunkReferenceVc` and `ParallelChunkReferenceVc` with `Chunk::parallel_chunks`. 2. Moves all non-generic optimization logic out of `turbopack-core` and into `turbopack-dev`. These optimization methods are very specific to a development environment, and `turbopack-build` will have different ones. ### Testing Instructions Snapshots link WEB-891
…el/turborepo#4601) See vercel/turborepo#4546 for the first attempt. This causes Next.js tests to fail. ~~Currently figuring out what's wrong.~~ This surfaced an existing issue in our chunk optimization logic, where chunks of different chunking contexts (SSR and RSC) would be merged together, leading to invalid module ids. link WEB-891
…el/turborepo#4546) ### Description This PR does two things, addressing related comments from vercel/turborepo#4450: 1. Replace `ChunkReferenceVc` and `ParallelChunkReferenceVc` with `Chunk::parallel_chunks`. 2. Moves all non-generic optimization logic out of `turbopack-core` and into `turbopack-dev`. These optimization methods are very specific to a development environment, and `turbopack-build` will have different ones. ### Testing Instructions Snapshots link WEB-891
…el/turborepo#4601) See vercel/turborepo#4546 for the first attempt. This causes Next.js tests to fail. ~~Currently figuring out what's wrong.~~ This surfaced an existing issue in our chunk optimization logic, where chunks of different chunking contexts (SSR and RSC) would be merged together, leading to invalid module ids. link WEB-891
Description
This PR does two things, addressing related comments from #4450:
ChunkReferenceVc
andParallelChunkReferenceVc
withChunk::parallel_chunks
.turbopack-core
and intoturbopack-dev
. These optimization methods are very specific to a development environment, andturbopack-build
will have different ones.Testing Instructions
Snapshots
link WEB-891