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
98fd3456
Unverified
Commit
98fd3456
authored
Jan 22, 2026
by
Tobias Koppers
Committed by
GitHub
Jan 22, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turbopack: query conditions in rules follow-ups (#88801)
Rebase of
https://github.com/vercel/next.js/pull/87291
parent
9e933be7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
7 deletions
+28
-7
next_config.rs
crates/next-core/src/next_config.rs
+11
-1
turbopack.mdx
...3-api-reference/05-config/01-next-config-js/turbopack.mdx
+3
-0
route.ts
test/e2e/turbopack-loader-config/app/api/route.ts
+2
-1
next.config.ts
test/e2e/turbopack-loader-config/next.config.ts
+8
-2
mod.rs
turbopack/crates/turbopack/src/module_options/mod.rs
+4
-3
No files found.
crates/next-core/src/next_config.rs
View file @
98fd3456
...
@@ -2106,6 +2106,13 @@ mod tests {
...
@@ -2106,6 +2106,13 @@ mod tests {
"browser"
,
"browser"
,
{
{
"path"
:
{
"type"
:
"glob"
,
"value"
:
"*.svg"
},
"path"
:
{
"type"
:
"glob"
,
"value"
:
"*.svg"
},
"query"
:
{
"type"
:
"regex"
,
"value"
:
{
"source"
:
"@someQuery"
,
"flags"
:
""
}
},
"content"
:
{
"content"
:
{
"source"
:
"@someTag"
,
"source"
:
"@someTag"
,
"flags"
:
""
"flags"
:
""
...
@@ -2140,7 +2147,10 @@ mod tests {
...
@@ -2140,7 +2147,10 @@ mod tests {
source
:
rcstr!
(
"@someTag"
),
source
:
rcstr!
(
"@someTag"
),
flags
:
rcstr!
(
""
),
flags
:
rcstr!
(
""
),
}),
}),
query
:
None
,
query
:
Some
(
ConfigConditionQuery
::
Regex
(
RegexComponents
{
source
:
rcstr!
(
"@someQuery"
),
flags
:
rcstr!
(
""
),
})),
},
},
]
]
.into
(),
.into
(),
...
...
docs/01-app/03-api-reference/05-config/01-next-config-js/turbopack.mdx
View file @
98fd3456
...
@@ -197,6 +197,9 @@ module.exports = {
...
@@ -197,6 +197,9 @@ module.exports = {
{
{
any: [
any: [
{ path: '*.svg' },
{ path: '*.svg' },
// 'query' matches anywhere in the full query string,
// which can be empty, or start with `?`.
{ query: /[?&]svgr(?=&|$)/ },
// 'content' is always a RegExp, and can match
// 'content' is always a RegExp, and can match
// anywhere in the file.
// anywhere in the file.
{ content: /\<svg\W/ },
{ content: /\<svg\W/ },
...
...
test/e2e/turbopack-loader-config/app/api/route.ts
View file @
98fd3456
import
{
NextResponse
}
from
'next/server'
import
{
NextResponse
}
from
'next/server'
import
foo
from
'../../foo.js'
import
foo
from
'../../foo.js'
import
bar
from
'../../bar.js'
// @ts-expect-error -- ignore
import
bar
from
'../../bar.js?test=hi'
export
async
function
GET
(
_req
)
{
export
async
function
GET
(
_req
)
{
return
NextResponse
.
json
(
return
NextResponse
.
json
(
...
...
test/e2e/turbopack-loader-config/next.config.ts
View file @
98fd3456
...
@@ -35,7 +35,10 @@ export default {
...
@@ -35,7 +35,10 @@ export default {
condition
:
{
condition
:
{
any
:
[
any
:
[
{
{
all
:
[
'development'
,
{
not
:
{
not
:
{
content
:
/export/
}
}
}],
all
:
[
'development'
,
{
not
:
{
not
:
{
query
:
/test=hi/
,
content
:
/export/
}
}
},
],
},
},
],
],
},
},
...
@@ -49,7 +52,10 @@ export default {
...
@@ -49,7 +52,10 @@ export default {
// this should match on production
// this should match on production
{
{
condition
:
{
condition
:
{
all
:
[{
not
:
'development'
},
{
content
:
/export/
}],
all
:
[
{
not
:
'development'
},
{
query
:
/test=hi/
,
content
:
/export/
},
],
},
},
loaders
:
[
loaders
:
[
{
{
...
...
turbopack/crates/turbopack/src/module_options/mod.rs
View file @
98fd3456
...
@@ -132,9 +132,6 @@ async fn rule_condition_from_webpack_condition(
...
@@ -132,9 +132,6 @@ async fn rule_condition_from_webpack_condition(
}
}
None
=>
{}
None
=>
{}
}
}
if
let
Some
(
content
)
=
content
{
rule_conditions
.push
(
RuleCondition
::
ResourceContentEsRegex
(
content
.await
?
));
}
match
&
query
{
match
&
query
{
Some
(
ConditionQuery
::
Constant
(
value
))
=>
{
Some
(
ConditionQuery
::
Constant
(
value
))
=>
{
rule_conditions
.push
(
RuleCondition
::
ResourceQueryEquals
(
value
.clone
()
.into
()));
rule_conditions
.push
(
RuleCondition
::
ResourceQueryEquals
(
value
.clone
()
.into
()));
...
@@ -144,6 +141,10 @@ async fn rule_condition_from_webpack_condition(
...
@@ -144,6 +141,10 @@ async fn rule_condition_from_webpack_condition(
}
}
None
=>
{}
None
=>
{}
}
}
// Add the content condition last since matching requires a more expensive file read.
if
let
Some
(
content
)
=
content
{
rule_conditions
.push
(
RuleCondition
::
ResourceContentEsRegex
(
content
.await
?
));
}
RuleCondition
::
All
(
rule_conditions
)
RuleCondition
::
All
(
rule_conditions
)
}
}
})
})
...
...
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