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 ourterms of serviceand privacy statement.We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self-reference dependency has unused export name when imported inside of a web worker #18315

Open
pgoldbergopened this issue Apr 11, 2024 · 2 comments · May be fixed by#18590
Open

Self-reference dependency has unused export name when imported inside of a web worker #18315

pgoldbergopened this issue Apr 11, 2024 · 2 comments · May be fixed by#18590

Comments

@pgoldberg
Copy link
Contributor

pgoldberg commented Apr 11, 2024

Bug report

What is the current behavior?

When a web worker imports a CommonJS module with a self reference dependency, webpack throwsError: Self-reference dependency has unused export name: This should not happen.

This happens whenusedExportsis set to"global".

I think this is related:
#12646/#12648

It seems like that fix works whenusedExportsis not set to"global",but it doesn't work whenusedExports: "global"is set.

If the current behavior is a bug, please provide the steps to reproduce.

Repro:https://github /pgoldberg/webpack-self-reference-dependency-worker-bug

What is the expected behavior?

Webpack should not throw an error

Other relevant information:
webpack version: 5.91.0
Node.js version: any
Operating System: any
Additional tools:

@bbb169
Copy link

bbb169 commented Jul 8, 2024

Hello, I did so work on this issue, and find out the process of bug occurrence, but I got no clue how to solve it, could anyone please give me some suggestion

Should I just ignore this error in CommonJsSelfReferenceDependency when config 'usedExports'?
@alexander-akait

image
image
image

@alexander-akait
Copy link
Member

Hm, you can send a PR and we will look our tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Priority - High
Development

Successfully merging a pull request may close this issue.

4 participants