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
2bb227eb
Unverified
Commit
2bb227eb
authored
Jul 31, 2025
by
Dario Lehmhus
Committed by
GitHub
Jul 31, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: turbopack loader ipc field mapping (#82112)
Co-authored-by:
Dario Lehmhus
<
dario.lehmhus@ffw.com
>
parent
189f971f
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
90 additions
and
0 deletions
+90
-0
layout.tsx
...app-dir/turbopack-loader-file-dependencies/app/layout.tsx
+8
-0
page.tsx
...t/app-dir/turbopack-loader-file-dependencies/app/page.tsx
+5
-0
loader.js
...ment/app-dir/turbopack-loader-file-dependencies/loader.js
+22
-0
next.config.js
...app-dir/turbopack-loader-file-dependencies/next.config.js
+23
-0
turbopack-loader-file-dependencies.test.ts
...e-dependencies/turbopack-loader-file-dependencies.test.ts
+25
-0
file-dependency.ts
...rbopack-loader-file-dependencies/utils/file-dependency.ts
+1
-0
file-to-transform.ts
...opack-loader-file-dependencies/utils/file-to-transform.ts
+5
-0
webpack.rs
turbopack/crates/turbopack-node/src/transforms/webpack.rs
+1
-0
No files found.
test/development/app-dir/turbopack-loader-file-dependencies/app/layout.tsx
0 → 100644
View file @
2bb227eb
import
{
ReactNode
}
from
'react'
export
default
function
Root
({
children
}:
{
children
:
ReactNode
})
{
return
(
<
html
>
<
body
>
{
children
}
</
body
>
</
html
>
)
}
test/development/app-dir/turbopack-loader-file-dependencies/app/page.tsx
0 → 100644
View file @
2bb227eb
import
{
utilFn
}
from
'../utils/file-to-transform'
export
default
function
Page
()
{
return
<
p
>
{
utilFn
()
}
</
p
>
}
test/development/app-dir/turbopack-loader-file-dependencies/loader.js
0 → 100644
View file @
2bb227eb
const
path
=
require
(
'node:path'
)
const
loader
=
async
function
(
content
)
{
this
.
async
()
if
(
!
this
.
resourcePath
.
endsWith
(
'file-to-transform.ts'
))
{
return
this
.
callback
(
null
,
content
)
}
const
dependencyFile
=
'./file-dependency.ts'
const
context
=
path
.
dirname
(
this
.
resourcePath
)
const
resolve
=
this
.
getResolve
({})
const
result
=
await
resolve
(
context
,
dependencyFile
)
this
.
addDependency
(
result
)
this
.
callback
(
null
,
`export const utilFn = () => 'Generated at
${
new
Date
().
toISOString
()}
';`
)
}
module
.
exports
=
loader
test/development/app-dir/turbopack-loader-file-dependencies/next.config.js
0 → 100644
View file @
2bb227eb
const
path
=
require
(
'node:path'
)
/**
* @type {import('next').NextConfig}
*/
const
nextConfig
=
{
turbopack
:
{
rules
:
{
'*.ts'
:
{
loaders
:
[
path
.
resolve
(
__dirname
,
'./loader.js'
)],
},
},
},
webpack
:
(
config
)
=>
{
config
.
module
.
rules
.
push
({
test
:
/
\.
ts$/
,
use
:
[
path
.
resolve
(
__dirname
,
'./loader.js'
)],
})
return
config
},
}
module
.
exports
=
nextConfig
test/development/app-dir/turbopack-loader-file-dependencies/turbopack-loader-file-dependencies.test.ts
0 → 100644
View file @
2bb227eb
import
{
nextTestSetup
}
from
'e2e-utils'
import
{
waitFor
}
from
'next-test-utils'
describe
(
'turbopack-loader-file-dependencies'
,
()
=>
{
const
{
next
}
=
nextTestSetup
({
files
:
__dirname
,
})
it
(
'should update when the dependency file changes'
,
async
()
=>
{
const
$
=
await
next
.
render$
(
'/'
)
const
initialText
=
await
$
(
'p'
).
text
()
expect
(
initialText
).
toBeTruthy
()
await
next
.
patchFile
(
'utils/file-dependency.ts'
,
'export const magicValue = "magic-value-2";'
)
await
waitFor
(
1000
)
const
$2
=
await
next
.
render$
(
'/'
)
const
newText
=
await
$2
(
'p'
).
text
()
expect
(
newText
).
not
.
toBe
(
initialText
)
})
})
test/development/app-dir/turbopack-loader-file-dependencies/utils/file-dependency.ts
0 → 100644
View file @
2bb227eb
export
const
magicValue
=
'magic-value'
test/development/app-dir/turbopack-loader-file-dependencies/utils/file-to-transform.ts
0 → 100644
View file @
2bb227eb
import
{
magicValue
}
from
'./file-dependency'
export
const
utilFn
=
()
=>
{
return
magicValue
}
turbopack/crates/turbopack-node/src/transforms/webpack.rs
View file @
2bb227eb
...
@@ -362,6 +362,7 @@ pub enum InfoMessage {
...
@@ -362,6 +362,7 @@ pub enum InfoMessage {
// Sent to inform Turbopack about the dependencies of the task.
// Sent to inform Turbopack about the dependencies of the task.
// All fields are `default` since it is ok for the client to
// All fields are `default` since it is ok for the client to
// simply omit instead of sending empty arrays.
// simply omit instead of sending empty arrays.
#[serde(rename_all
=
"camelCase"
)]
Dependencies
{
Dependencies
{
#[serde(default)]
#[serde(default)]
env_variables
:
Vec
<
RcStr
>
,
env_variables
:
Vec
<
RcStr
>
,
...
...
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