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

Support for ignoring lazy (not weak) async imports #67

Open
jtbandes opened this issue Mar 4, 2021 · 2 comments
Open

Support for ignoring lazy (not weak) async imports #67

jtbandes opened this issue Mar 4, 2021 · 2 comments

Comments

@jtbandes
Copy link

jtbandes commented Mar 4, 2021

The note on allowAsyncCycles gives an example of using it for weak imports:

      // allow import cycles that include an asyncronous import,
      // e.g. via import(/* webpackMode: "weak" */ './file.js')
      allowAsyncCycles: false,

But it would be nice if this also worked for regular async imports that aren't marked with webpackMode: "weak". It sounds like the default mode for async imports is lazy. https://webpack.js.org/api/module-methods/#magic-comments

@jtbandes
Copy link
Author

jtbandes commented Mar 5, 2021

After some further testing I've noticed that this reproduces when using TypeScript with the compiler flag "module": "commonjs".

@ferm10n
Copy link

ferm10n commented Oct 2, 2023

I'd love to fix this, but I haven't any clue how to tell from a Dependency / ModuleDependency that it's imported via import().

Here's what circular-dependency-plugin looks at:

if (this.options.allowAsyncCycles && dependency.weak) { continue }

And the source from webpack:
https://github.com/webpack/webpack/blob/1f13ff9fe587e094df59d660b4611b1bd19aed4c/lib/Dependency.js#L100

It's really frustrating how hard it is to find a reference for webpack APIs like this.

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

No branches or pull requests

2 participants