Skip to content
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

Turbopack loader ignores resource query on aliased imports #72561

Open
sam3d opened this issue Nov 10, 2024 · 1 comment
Open

Turbopack loader ignores resource query on aliased imports #72561

sam3d opened this issue Nov 10, 2024 · 1 comment
Labels
bug Issue was opened via the bug report template. Turbopack Related to Turbopack with Next.js.

Comments

@sam3d
Copy link
Contributor

sam3d commented Nov 10, 2024

Link to the code that reproduces this issue

https://github.com/sam3d/turbopack-resource-query-repro

To Reproduce

Start the application usng pnpm dev (turbopack is enabled by default)

Current vs. Expected behavior

I'd expect both a relative and aliased import to behave the same way:

import isHello from "./example.txt?hello";
import shouldBeWorld from "@/app/example.txt?world";

export default async function Page() {
  return (
    <ul>
      <li>isHello: {isHello}</li>
      <li>shouldBeWorld: {shouldBeWorld}</li>
    </ul>
  );
}

However they do not, as the resource query is not passed to the loader when accessing with @/app/...:

image

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.0.0: Mon Aug 12 20:51:54 PDT 2024; root:xnu-11215.1.10~2/RELEASE_ARM64_T6000
  Available memory (MB): 65536
  Available CPU cores: 10
Binaries:
  Node: 20.11.1
  npm: 10.2.4
  Yarn: 1.22.19
  pnpm: 9.12.3
Relevant Packages:
  next: 15.0.4-canary.4 // Latest available version is detected (15.0.4-canary.4).
  eslint-config-next: 15.0.4-canary.4
  react: 19.0.0-rc-66855b96-20241106
  react-dom: 19.0.0-rc-66855b96-20241106
  typescript: 5.6.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

No response

@sam3d sam3d added the bug Issue was opened via the bug report template. label Nov 10, 2024
@github-actions github-actions bot added the Turbopack Related to Turbopack with Next.js. label Nov 10, 2024
@JesseKoldewijn
Copy link
Contributor

I believe there's already a couple of issues present regarding the resource imports in TurboPack. So that part of your issue might be a slight duplicate of these existing issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Turbopack Related to Turbopack with Next.js.
Projects
None yet
Development

No branches or pull requests

2 participants