Skip to content

Commit

Permalink
Use ProxiedAsset instead of css_chunk_root_path to expose RSC CSS chu…
Browse files Browse the repository at this point in the history
…nks (#48946)

See vercel/turbo#4740

This enables RSC CSS HMR. The `css_chunk_root_path` way somehow broke
the propagation of invalidation for CSS chunks.

This also updates Turbopack with the following changes:

* vercel/turbo#4738 <!-- Tobias Koppers -
improve commonjs esm interop and node ESM -->
* vercel/turbo#4740 <!-- Alex Kirszenberg -
Replace css_chunk_root_path with ProxiedAsset -->
* vercel/turbo#4741 <!-- Tobias Koppers - add
svg size extraction -->

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
  • Loading branch information
alexkirsz and sokra committed Apr 28, 2023
1 parent b3071ad commit 7b348fa
Show file tree
Hide file tree
Showing 9 changed files with 146 additions and 127 deletions.
68 changes: 35 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Expand Up @@ -42,11 +42,11 @@ swc_relay = { version = "0.2.5" }
testing = { version = "0.33.4" }

# Turbo crates
turbo-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230427.3" }
turbo-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230428.3" }
# [TODO]: need to refactor embed_directory! macro usages, as well as resolving turbo_tasks::function, macros..
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230427.3" }
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230428.3" }
# [TODO]: need to refactor embed_directory! macro usage in next-core
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230427.3" }
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230428.3" }

# General Deps

Expand Down
4 changes: 2 additions & 2 deletions packages/next-swc/crates/next-core/js/package.json
Expand Up @@ -10,8 +10,8 @@
"check": "tsc --noEmit"
},
"dependencies": {
"@vercel/turbopack-dev": "https://gitpkg.vercel.app/vercel/turbo/crates/turbopack-dev/js?turbopack-230427.3",
"@vercel/turbopack-node": "https://gitpkg.vercel.app/vercel/turbo/crates/turbopack-node/js?turbopack-230427.3",
"@vercel/turbopack-dev": "https://gitpkg.vercel.app/vercel/turbo/crates/turbopack-dev/js?turbopack-230428.3",
"@vercel/turbopack-node": "https://gitpkg.vercel.app/vercel/turbo/crates/turbopack-node/js?turbopack-230428.3",
"anser": "^2.1.1",
"css.escape": "^1.5.1",
"next": "*",
Expand Down
Expand Up @@ -4,6 +4,7 @@ import type { ReactElement } from 'react'
import { version } from 'next/package.json'
import { createFromReadableStream } from 'next/dist/compiled/react-server-dom-webpack/client'
import { callServer } from 'next/dist/client/app-call-server'
import { linkGc } from 'next/dist/client/app-link-gc'

import { HeadManagerContext } from 'next/dist/shared/lib/head-manager-context'

Expand Down Expand Up @@ -153,6 +154,8 @@ function hydrate() {
ReactDOMClient.hydrateRoot(appElement, reactEl)
})
}

linkGc()
}

window.next = {
Expand Down
2 changes: 0 additions & 2 deletions packages/next-swc/crates/next-core/src/app_source.rs
Expand Up @@ -933,7 +933,6 @@ import {}, {{ chunks as {} }} from "COMPONENT_{}";
context.compile_time_info().environment(),
)
.layer("ssr")
.css_chunk_root_path(server_root.join("_next/static/chunks"))
.reference_chunk_source_maps(false)
.build();

Expand Down Expand Up @@ -1013,7 +1012,6 @@ impl AppRouteVc {
this.context.compile_time_info().environment(),
)
.layer("ssr")
.css_chunk_root_path(this.server_root.join("_next/static/chunks"))
.reference_chunk_source_maps(false)
.build();

Expand Down

0 comments on commit 7b348fa

Please sign in to comment.