Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
54c65882
Commit
54c65882
authored
Mar 30, 2026
by
Luke Sandberg
Committed by
Luke Sandberg
Mar 31, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
review
parent
ec1c363d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
9 deletions
+15
-9
taskfile.js
packages/next/taskfile.js
+3
-0
runtime-base.ts
...-ecmascript-runtime/js/src/nodejs/runtime/runtime-base.ts
+5
-2
base-externals-utils.ts
...script-runtime/js/src/shared-node/base-externals-utils.ts
+2
-2
loader_module.rs
...crates/turbopack-ecmascript/src/manifest/loader_module.rs
+5
-5
No files found.
packages/next/taskfile.js
View file @
54c65882
...
@@ -1571,6 +1571,8 @@ export async function copy_vendor_react(task_) {
...
@@ -1571,6 +1571,8 @@ export async function copy_vendor_react(task_) {
* Replaces the body of a named function declaration/expression.
* Replaces the body of a named function declaration/expression.
* Finds `function <name>(` and uses brace counting to locate the
* Finds `function <name>(` and uses brace counting to locate the
* full body, then replaces it with the provided code.
* full body, then replaces it with the provided code.
*
* This is brittle but does work for our current usecase
*/
*/
function
replaceFunctionBody
(
function
replaceFunctionBody
(
/** @type {string} */
code
,
/** @type {string} */
code
,
...
@@ -1782,6 +1784,7 @@ export async function copy_vendor_react(task_) {
...
@@ -1782,6 +1784,7 @@ export async function copy_vendor_react(task_) {
// to eliminate all promise tracking overhead — the chunks are
// to eliminate all promise tracking overhead — the chunks are
// already loaded synchronously, so we just need to call
// already loaded synchronously, so we just need to call
// __next_chunk_load__ for side effects and handle async modules.
// __next_chunk_load__ for side effects and handle async modules.
// TODO: this should be upstreamed into react
code
=
replaceFunctionBody
(
code
=
replaceFunctionBody
(
code
,
code
,
'preloadModule'
,
'preloadModule'
,
...
...
turbopack/crates/turbopack-ecmascript-runtime/js/src/nodejs/runtime/runtime-base.ts
View file @
54c65882
...
@@ -96,11 +96,14 @@ function loadChunkPath(
...
@@ -96,11 +96,14 @@ function loadChunkPath(
const
error
=
new
Error
(
const
error
=
new
Error
(
sourceIsModule
sourceIsModule
?
`Failed to load chunk
${
chunkPath
}
from module
${
sourceId
}
`
?
`Failed to load chunk
${
chunkPath
}
from module
${
sourceId
}
`
:
`Failed to load chunk
${
chunkPath
}
from runtime for chunk
${
sourceId
}
`
,
:
`Failed to load chunk
${
chunkPath
}
${
sourceId
?
`from runtime for chunk
${
sourceId
}
`
:
''
}
`
,
{
cause
}
{
cause
}
)
)
error
.
name
=
'ChunkLoadError'
error
.
name
=
'ChunkLoadError'
loadedChunks
.
set
(
chunkPath
,
error
)
// Don't cache runtime chunk loading errors
if
(
!
sourceIsModule
)
{
loadedChunks
.
set
(
chunkPath
,
error
)
}
throw
error
throw
error
}
}
}
}
...
...
turbopack/crates/turbopack-ecmascript-runtime/js/src/shared-node/base-externals-utils.ts
View file @
54c65882
...
@@ -61,7 +61,7 @@ contextPrototype.x = externalRequire
...
@@ -61,7 +61,7 @@ contextPrototype.x = externalRequire
// Chunk loading is synchronous in these runtimes, so loaders may return plain
// Chunk loading is synchronous in these runtimes, so loaders may return plain
// values or throw. The async keyword ensures dynamic import() always returns
// values or throw. The async keyword ensures dynamic import() always returns
// a Promise per spec without an extra microtask in the browser path.
// a Promise per spec without an extra microtask in the browser path.
async
function
asyncLoader
Sync
(
async
function
asyncLoader
(
this
:
TurbopackBaseContext
<
Module
>
,
this
:
TurbopackBaseContext
<
Module
>
,
moduleId
:
ModuleId
moduleId
:
ModuleId
):
Promise
<
Exports
>
{
):
Promise
<
Exports
>
{
...
@@ -70,4 +70,4 @@ async function asyncLoaderSync(
...
@@ -70,4 +70,4 @@ async function asyncLoaderSync(
)
=>
Exports
|
Promise
<
Exports
>
)
=>
Exports
|
Promise
<
Exports
>
return
loader
(
esmImport
.
bind
(
this
))
return
loader
(
esmImport
.
bind
(
this
))
}
}
contextPrototype
.
A
=
asyncLoader
Sync
contextPrototype
.
A
=
asyncLoader
turbopack/crates/turbopack-ecmascript/src/manifest/loader_module.rs
View file @
54c65882
...
@@ -174,14 +174,14 @@ impl EcmascriptChunkPlaceable for ManifestLoaderModule {
...
@@ -174,14 +174,14 @@ impl EcmascriptChunkPlaceable for ManifestLoaderModule {
code
,
code
,
r
#
"
r
#
"
{TURBOPACK_EXPORT_VALUE}((parentImport) => {{
{TURBOPACK_EXPORT_VALUE}((parentImport) => {{
var serverChunks = {chunks_server_data:#};
var chunks = {chunks_server_data:#};
for (var i = 0; i < serverChunks.length; i++) {{
{TURBOPACK_LOAD}(serverChunks[i]);
}}
var chunks = {TURBOPACK_REQUIRE}({item_id});
for (var i = 0; i < chunks.length; i++) {{
for (var i = 0; i < chunks.length; i++) {{
{TURBOPACK_LOAD}(chunks[i]);
{TURBOPACK_LOAD}(chunks[i]);
}}
}}
chunks = {TURBOPACK_REQUIRE}({item_id});
for (i = 0; i < chunks.length; i++) {{
{TURBOPACK_LOAD}(chunks[i]);
}}
return parentImport({dynamic_id});
return parentImport({dynamic_id});
}});
}});
"
#
,
"
#
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment