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

pdfjs-dist fails to compile with Turbopack (webpackIgnore comment not respected) #65406

Open
timneutkens opened this issue May 6, 2024 · 1 comment
Labels
bug Issue was opened via the bug report template. linear: turbopack Confirmed issue that is tracked by the Turbopack team. Turbopack Related to Turbopack with Next.js.

Comments

@timneutkens
Copy link
Member

timneutkens commented May 6, 2024

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/pdf-viewer-forked-h3gdsc?file=%2Fcomponents%2FTestPage.tsx

To Reproduce

  1. Open https://codesandbox.io/p/devbox/pdf-viewer-forked-h3gdsc?file=%2Fcomponents%2FTestPage.tsx
  2. Observe the compilation failing with Module not found (example: https://h3gdsc-3000.csb.app/)

Current vs. Expected behavior

pdfjs-dist ships with a webpack specific ignore comment (:til: that is a feature) as they use import() to load a file based on an option being passed in.

Specifically const worker = await import(/* webpackIgnore: true */ this.workerSrc); fails to compile as it can't find this.workerSrc statically.

I'm not sure what the best behavior is for this, adding support for the comment or ignoring such imports when they don't include a path.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.12.0
  npm: 10.5.0
  Yarn: 1.22.19
  pnpm: 8.15.6
Relevant Packages:
  next: 14.3.0-canary.40 // Latest available version is detected (14.3.0-canary.40).
  eslint-config-next: 14.1.0
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.3.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), next build (local), next start (local), Vercel (Deployed), Other (Deployed)

Additional context

This is failing on all versions with Turbopack as it doesn't support the ignore comment.

PACK-3046

@timneutkens timneutkens added the bug Issue was opened via the bug report template. label May 6, 2024
@github-actions github-actions bot added the Turbopack Related to Turbopack with Next.js. label May 6, 2024
@timneutkens
Copy link
Member Author

This issue came out of #63385 (comment)

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. linear: turbopack Confirmed issue that is tracked by the Turbopack team. Turbopack Related to Turbopack with Next.js.
Projects
None yet
Development

No branches or pull requests

1 participant