Skip to content

[Feature]: webpackIgnore magic comment is not working for new URL calls #10444

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

Closed
leonardlib opened this issue May 21, 2025 · 0 comments · Fixed by #10506
Closed

[Feature]: webpackIgnore magic comment is not working for new URL calls #10444

leonardlib opened this issue May 21, 2025 · 0 comments · Fixed by #10506
Assignees

Comments

@leonardlib
Copy link

leonardlib commented May 21, 2025

System Info

System:

OS: macOS 15.3.2
CPU: (8) arm64 Apple M1
Memory: 100.50 MB / 16.00 GB
Shell: 5.9 - /bin/zsh

Binaries:

Node: 22.13.1 - ~/.nvm/versions/node/v22.13.1/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v22.13.1/bin/yarn
npm: 10.9.2 - ~/.nvm/versions/node/v22.13.1/bin/npm

Browsers:

Chrome: 136.0.7103.114
Edge: 136.0.3240.76
Safari: 18.3.1

npmPackages:

@rspack/cli: ^1.3.11 => 1.3.11
@rspack/core: ^1.3.11 => 1.3.11
@rspack/dev-server: ^1.1.2 => 1.1.2
@rspack/plugin-minify: ^0.7.5 => 0.7.5
@rspack/plugin-react-refresh: ^1.4.3 => 1.4.3

Details

I'm using an external package that has a Worker that should not be bundled within my application, so the implementation looks like this:

pdfjs.GlobalWorkerOptions.workerSrc = new URL(
  /* webpackIgnore: true */ 'pdfjs-dist/legacy/build/pdf.worker.min.js',
  import.meta.url,
).toString();

When I bundle my application with Webpack, it works well, externalizing the Worker:

Image

But when I use Rspack, the Worker is bundled (which is incorrect):

Image

So it seems that the /* webpackIgnore: true */ comment is not working well

Reproduce link

No response

Reproduce Steps

npx nx run my-app:build

@leonardlib leonardlib added the pending triage The issue/PR is currently untouched. label May 21, 2025
@LingyuCoder LingyuCoder removed the pending triage The issue/PR is currently untouched. label May 23, 2025
@LingyuCoder LingyuCoder changed the title [Bug]: webpackIgnore magic comment is not working for new URL calls [Feature]: webpackIgnore magic comment is not working for new URL calls May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants