-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Open
Labels
TurbopackRelated to Turbopack with Next.js.Related to Turbopack with Next.js.linear: turbopackConfirmed issue that is tracked by the Turbopack team.Confirmed issue that is tracked by the Turbopack team.
Description
Link to the code that reproduces this issue
https://github.com/iamnafets/next-resourcequery/tree/main/reproduction-app
To Reproduce
- Start the application with
yarn dev --turbo - Load up
/note theUnknown module typeerror. - Start the application with
yarn dev - Note no errors.
Current vs. Expected behavior
Turbopack doesn't appear to support glob patterns that include the resource query. While the loaders themselves have access to the resource query, the extension patterns do not.
So a loader like this:
{
/// ...
turbopack: {
rules: {
"*\\?raw": {
loaders: [require.resolve("./loader.js")],
as: "*.js"
},
// This also doesn't work
{
"*.txt\\?raw": {
loaders: [require.resolve("./loader.js")],
as: "*.js"
},
// This doesn't work either and crashes turbopack
"*?raw": {
loaders: [require.resolve("./loader.js")],
as: "*.js"
}
*/
}
}
}Does not work.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.6.0: Fri Jul 5 17:56:15 PDT 2024; root:xnu-10063.141.1~2/RELEASE_ARM64_T6031
Available memory (MB): 65536
Available CPU cores: 16
Binaries:
Node: 22.14.0
npm: 10.9.2
Yarn: 1.22.22
pnpm: N/A
Relevant Packages:
next: 15.4.0-canary.36 // Latest available version is detected (15.4.0-canary.36).
eslint-config-next: N/A
react: 19.1.0
react-dom: 19.1.0
typescript: 5.8.3
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
Turbopack
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
There doesn't appear to be a workaround here. I thought I might be able to write a custom loader that would pitch, interrogate the resource query, and then grab the resource if it matched but I have no way to override the loaders and the data in pitch is an empty object.
Janpot, akichula, dLebrov and hasegawa-yuki-gnavi
Metadata
Metadata
Assignees
Labels
TurbopackRelated to Turbopack with Next.js.Related to Turbopack with Next.js.linear: turbopackConfirmed issue that is tracked by the Turbopack team.Confirmed issue that is tracked by the Turbopack team.