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
5ca62ef4
Unverified
Commit
5ca62ef4
authored
Sep 24, 2026
by
Niklas Mischkulnig
Committed by
GitHub
Sep 24, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turbopack: fix another "ModuleId not found for ident" regression (#99102)
Regression from #98617
parent
e7184817
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
67 additions
and
10 deletions
+67
-10
layout.jsx
...e/app-dir/client-reference-reexport-unused/app/layout.jsx
+7
-0
page.jsx
...e2e/app-dir/client-reference-reexport-unused/app/page.jsx
+1
-0
client-reference-reexport-unused.test.ts
...-reexport-unused/client-reference-reexport-unused.test.ts
+16
-0
next.config.mjs
.../app-dir/client-reference-reexport-unused/next.config.mjs
+7
-0
.gitignore
...-dir/client-reference-reexport-unused/test-pkg/.gitignore
+1
-0
index.js
...nt-reference-reexport-unused/test-pkg/dist/src/a/index.js
+3
-0
b.js
...client-reference-reexport-unused/test-pkg/dist/src/b/b.js
+5
-0
index.js
...ient-reference-reexport-unused/test-pkg/dist/src/index.js
+2
-0
package.json
...ir/client-reference-reexport-unused/test-pkg/package.json
+9
-0
export.rs
.../crates/turbopack-ecmascript/src/references/esm/export.rs
+16
-10
No files found.
test/e2e/app-dir/client-reference-reexport-unused/app/layout.jsx
0 → 100644
View file @
5ca62ef4
export
default
function
Root
({
children
})
{
return
(
<
html
>
<
body
>
{
children
}
</
body
>
</
html
>
)
}
test/e2e/app-dir/client-reference-reexport-unused/app/page.jsx
0 → 100644
View file @
5ca62ef4
export
{
B
as
default
}
from
'test-pkg/base'
test/e2e/app-dir/client-reference-reexport-unused/client-reference-reexport-unused.test.ts
0 → 100644
View file @
5ca62ef4
import
{
nextTestSetup
}
from
'e2e-utils'
describe
(
'client-reference-reexport-unused'
,
()
=>
{
const
{
next
}
=
nextTestSetup
({
files
:
__dirname
,
dependencies
:
{
'test-pkg'
:
'file:./test-pkg'
,
},
})
it
(
'builds and serves a page re-exported from a side-effect-free package'
,
async
()
=>
{
const
res
=
await
next
.
fetch
(
'/'
)
expect
(
res
.
status
).
toBe
(
200
)
expect
(
await
res
.
text
()).
toContain
(
'<html'
)
})
})
test/e2e/app-dir/client-reference-reexport-unused/next.config.mjs
0 → 100644
View file @
5ca62ef4
const
nextConfig
=
{
turbopack
:
{
root
:
'.'
,
},
}
export
default
nextConfig
test/e2e/app-dir/client-reference-reexport-unused/test-pkg/.gitignore
0 → 100644
View file @
5ca62ef4
!dist/
test/e2e/app-dir/client-reference-reexport-unused/test-pkg/dist/src/a/index.js
0 → 100644
View file @
5ca62ef4
'use client'
export
function
A
()
{}
test/e2e/app-dir/client-reference-reexport-unused/test-pkg/dist/src/b/b.js
0 → 100644
View file @
5ca62ef4
'use client'
export
function
B
()
{
return
null
}
test/e2e/app-dir/client-reference-reexport-unused/test-pkg/dist/src/index.js
0 → 100644
View file @
5ca62ef4
export
*
from
'./a'
export
*
from
'./b/b'
test/e2e/app-dir/client-reference-reexport-unused/test-pkg/package.json
0 → 100644
View file @
5ca62ef4
{
"name"
:
"test-pkg"
,
"version"
:
"1.0.0"
,
"private"
:
true
,
"sideEffects"
:
false
,
"exports"
:
{
"./base"
:
"./dist/src/index.js"
}
}
turbopack/crates/turbopack-ecmascript/src/references/esm/export.rs
View file @
5ca62ef4
...
@@ -679,6 +679,7 @@ async fn build_compact_reexports(
...
@@ -679,6 +679,7 @@ async fn build_compact_reexports(
chunking_context
:
Vc
<
Box
<
dyn
ChunkingContext
>>
,
chunking_context
:
Vc
<
Box
<
dyn
ChunkingContext
>>
,
scope_hoisting_context
:
ScopeHoistingContext
<
'_
>
,
scope_hoisting_context
:
ScopeHoistingContext
<
'_
>
,
)
->
Result
<
Option
<
CompactReexports
>>
{
)
->
Result
<
Option
<
CompactReexports
>>
{
let
unused_references
=
chunking_context
.unused_references
()
.await
?
;
let
locally_bound
:
FxHashSet
<
usize
>
=
eval_context
let
locally_bound
:
FxHashSet
<
usize
>
=
eval_context
.imports
.imports
.locally_bound_reference_idxs
()
.locally_bound_reference_idxs
()
...
@@ -696,11 +697,7 @@ async fn build_compact_reexports(
...
@@ -696,11 +697,7 @@ async fn build_compact_reexports(
// a group for a reference the usage graph pruned: its target may not exist in this chunk,
// a group for a reference the usage graph pruned: its target may not exist in this chunk,
// and its code generation deliberately emits no namespace binding either.
// and its code generation deliberately emits no namespace binding either.
for
(
order
,
reference
)
in
part_references
.iter
()
.enumerate
()
{
for
(
order
,
reference
)
in
part_references
.iter
()
.enumerate
()
{
if
chunking_context
if
unused_references
.contains_key
(
&
ResolvedVc
::
upcast
(
*
reference
))
{
.unused_references
()
.contains_key
(
&
ResolvedVc
::
upcast
(
*
reference
))
.await
?
{
continue
;
continue
;
}
}
...
@@ -735,11 +732,7 @@ async fn build_compact_reexports(
...
@@ -735,11 +732,7 @@ async fn build_compact_reexports(
for
(
index
,
reference
)
in
esm_references
.iter
()
.enumerate
()
{
for
(
index
,
reference
)
in
esm_references
.iter
()
.enumerate
()
{
// Unused re-exports are absent from the module ID map and cannot contribute
// Unused re-exports are absent from the module ID map and cannot contribute
// an import or a source-order position to the compact registration.
// an import or a source-order position to the compact registration.
if
chunking_context
if
unused_references
.contains_key
(
&
ResolvedVc
::
upcast
(
*
reference
))
{
.unused_references
()
.contains_key
(
&
ResolvedVc
::
upcast
(
*
reference
))
.await
?
{
continue
;
continue
;
}
}
...
@@ -759,6 +752,12 @@ async fn build_compact_reexports(
...
@@ -759,6 +752,12 @@ async fn build_compact_reexports(
let
EsmExport
::
ImportedBinding
(
esm_ref
,
imported_name
,
mutable
)
=
local
else
{
let
EsmExport
::
ImportedBinding
(
esm_ref
,
imported_name
,
mutable
)
=
local
else
{
return
Ok
(
None
);
return
Ok
(
None
);
};
};
// The usage graph can prune a re-export's target even though its name is still
// present in the facade's expanded export list. Do not generate a module ID for
// a target that was excluded from chunking.
if
unused_references
.contains_key
(
esm_ref
)
{
continue
;
}
if
*
mutable
{
if
*
mutable
{
// A mutable re-export needs a setter, which the compact form cannot express.
// A mutable re-export needs a setter, which the compact form cannot express.
return
Ok
(
None
);
return
Ok
(
None
);
...
@@ -1009,6 +1008,7 @@ impl EsmExports {
...
@@ -1009,6 +1008,7 @@ impl EsmExports {
synthetic_references
:
Option
<
SyntheticReexportReferences
<
'_
>>
,
synthetic_references
:
Option
<
SyntheticReexportReferences
<
'_
>>
,
is_async_module
:
bool
,
is_async_module
:
bool
,
)
->
Result
<
(
CodeGeneration
,
SubsumedImports
)
>
{
)
->
Result
<
(
CodeGeneration
,
SubsumedImports
)
>
{
let
unused_references
=
chunking_context
.unused_references
()
.await
?
;
let
export_usage_info
=
chunking_context
let
export_usage_info
=
chunking_context
.module_export_usage
(
*
ResolvedVc
::
upcast
(
module
))
.module_export_usage
(
*
ResolvedVc
::
upcast
(
module
))
.await
?
;
.await
?
;
...
@@ -1102,6 +1102,12 @@ impl EsmExports {
...
@@ -1102,6 +1102,12 @@ impl EsmExports {
}
}
for
(
exported
,
local
)
in
&
expanded
.exports
{
for
(
exported
,
local
)
in
&
expanded
.exports
{
if
let
EsmExport
::
ImportedBinding
(
reference
,
..
)
|
EsmExport
::
ImportedNamespace
(
reference
)
=
local
&&
unused_references
.contains_key
(
reference
)
{
continue
;
}
let
exprs
:
ExportBinding
=
match
local
{
let
exprs
:
ExportBinding
=
match
local
{
EsmExport
::
Error
=>
ExportBinding
::
Getter
(
quote!
(
EsmExport
::
Error
=>
ExportBinding
::
Getter
(
quote!
(
"(() => { throw new Error(
\
"
Failed
binding
. See
build
errors!
\
"); })"
as
Expr
,
"(() => { throw new Error(
\
"
Failed
binding
. See
build
errors!
\
"); })"
as
Expr
,
...
...
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