Skip to content

Turbopack Fails with ResourceQuery in Glob Pattern #79311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
iamnafets opened this issue May 16, 2025 · 0 comments
Open

Turbopack Fails with ResourceQuery in Glob Pattern #79311

iamnafets opened this issue May 16, 2025 · 0 comments
Labels
Turbopack Related to Turbopack with Next.js.

Comments

@iamnafets
Copy link

iamnafets commented May 16, 2025

Link to the code that reproduces this issue

https://github.com/iamnafets/next-resourcequery/tree/main/reproduction-app

To Reproduce

  1. Start the application with yarn dev --turbo
  2. Load up / note the Unknown module type error.
  3. Start the application with yarn dev
  4. 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/A

Which 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.

@github-actions github-actions bot added the Turbopack Related to Turbopack with Next.js. label May 16, 2025
@iamnafets iamnafets changed the title Turbopack Not Supporting Resourcequery in Glob Pattern Turbopack Fails with Resourceuery in Glob Pattern May 16, 2025
@iamnafets iamnafets changed the title Turbopack Fails with Resourceuery in Glob Pattern Turbopack Fails with ResourceQuery in Glob Pattern May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Turbopack Related to Turbopack with Next.js.
Projects
None yet
Development

No branches or pull requests

1 participant