Commit 34ee0757 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig

only public path, not static/chunks

parent 5d532e0a
...@@ -177,8 +177,7 @@ async fn build_manifest( ...@@ -177,8 +177,7 @@ async fn build_manifest(
rcstr!("") rcstr!("")
}; };
entry_manifest.module_loading.prefix = entry_manifest.module_loading.prefix = prefix_path;
format!("{}static/chunks", prefix_path).into();
entry_manifest.module_loading.cross_origin = next_config.cross_origin().owned().await?; entry_manifest.module_loading.cross_origin = next_config.cross_origin().owned().await?;
let ClientReferencesChunks { let ClientReferencesChunks {
client_component_client_chunks, client_component_client_chunks,
...@@ -284,15 +283,9 @@ async fn build_manifest( ...@@ -284,15 +283,9 @@ async fn build_manifest(
// be handled separately. // be handled separately.
.filter(|path| path.ends_with(".js")) .filter(|path| path.ends_with(".js"))
.map(|path| { .map(|path| {
// All client JS chunks are under `static/chunks/`. Strip
// that prefix here since `moduleLoading.prefix` already
// contains it, saving one repetition per entry.
let relative = path
.strip_prefix("static/chunks")
.unwrap_or(&path);
format!( format!(
"{}{}", "{}{}",
relative.split('/').map(encode_uri_component).format("/"), path.split('/').map(encode_uri_component).format("/"),
suffix_path suffix_path
) )
}) })
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
i < chunks.length; i < chunks.length;
i++ i++
) { ) {
var thenable = __turbopack_load_by_url__(chunks[i]); var thenable = __turbopack_load__(chunks[i]);
loadedChunks.has(thenable) || promises.push(thenable); loadedChunks.has(thenable) || promises.push(thenable);
if (!instrumentedChunks.has(thenable)) { if (!instrumentedChunks.has(thenable)) {
var resolve = loadedChunks.add.bind(loadedChunks, thenable); var resolve = loadedChunks.add.bind(loadedChunks, thenable);
......
...@@ -74,7 +74,7 @@ var instrumentedChunks = new WeakSet(), ...@@ -74,7 +74,7 @@ var instrumentedChunks = new WeakSet(),
function ignoreReject() {} function ignoreReject() {}
function preloadModule(metadata) { function preloadModule(metadata) {
for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; i++) { for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; i++) {
var thenable = __turbopack_load_by_url__(chunks[i]); var thenable = __turbopack_load__(chunks[i]);
loadedChunks.has(thenable) || promises.push(thenable); loadedChunks.has(thenable) || promises.push(thenable);
if (!instrumentedChunks.has(thenable)) { if (!instrumentedChunks.has(thenable)) {
var resolve = loadedChunks.add.bind(loadedChunks, thenable); var resolve = loadedChunks.add.bind(loadedChunks, thenable);
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
i < chunks.length; i < chunks.length;
i++ i++
) { ) {
var thenable = __turbopack_load_by_url__(chunks[i]); var thenable = __turbopack_load__(chunks[i]);
loadedChunks.has(thenable) || promises.push(thenable); loadedChunks.has(thenable) || promises.push(thenable);
if (!instrumentedChunks.has(thenable)) { if (!instrumentedChunks.has(thenable)) {
var resolve = loadedChunks.add.bind(loadedChunks, thenable); var resolve = loadedChunks.add.bind(loadedChunks, thenable);
......
...@@ -74,7 +74,7 @@ var instrumentedChunks = new WeakSet(), ...@@ -74,7 +74,7 @@ var instrumentedChunks = new WeakSet(),
function ignoreReject() {} function ignoreReject() {}
function preloadModule(metadata) { function preloadModule(metadata) {
for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; i++) { for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; i++) {
var thenable = __turbopack_load_by_url__(chunks[i]); var thenable = __turbopack_load__(chunks[i]);
loadedChunks.has(thenable) || promises.push(thenable); loadedChunks.has(thenable) || promises.push(thenable);
if (!instrumentedChunks.has(thenable)) { if (!instrumentedChunks.has(thenable)) {
var resolve = loadedChunks.add.bind(loadedChunks, thenable); var resolve = loadedChunks.add.bind(loadedChunks, thenable);
......
...@@ -1715,7 +1715,15 @@ export async function copy_vendor_react(task_) { ...@@ -1715,7 +1715,15 @@ export async function copy_vendor_react(task_) {
// package will be bundled alongside user code and we don't need to introduce the extra // package will be bundled alongside user code and we don't need to introduce the extra
// indirection // indirection
if ( if (file.base.startsWith('react-server-dom-turbopack-client.browser')) {
const source = file.data.toString()
let newSource = source.replace(
/__turbopack_load_by_url__/g,
'__turbopack_load__'
)
file.data = newSource
} else if (
(file.base.startsWith('react-server-dom-turbopack-client') || (file.base.startsWith('react-server-dom-turbopack-client') ||
file.base.startsWith('react-server-dom-turbopack-server')) && file.base.startsWith('react-server-dom-turbopack-server')) &&
!file.base.includes('.browser.') !file.base.includes('.browser.')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment