Skip to content

Add option to allow cycles that include an asynchronous dependency#37

Merged
aackerman merged 2 commits into
aackerman:masterfrom
hedgepigdaniel:5.0-async-deps
Apr 27, 2018
Merged

Add option to allow cycles that include an asynchronous dependency#37
aackerman merged 2 commits into
aackerman:masterfrom
hedgepigdaniel:5.0-async-deps

Conversation

@hedgepigdaniel
Copy link
Copy Markdown
Contributor

@hedgepigdaniel hedgepigdaniel commented Apr 26, 2018

When using this plugin in conjunction with babel-plugin-universal-import and react-universal-component, warnings are generated for import cycles even if one of the imports in the cycle is an asynchronous import() promise. This happens because of the require.resolveWeak used by babel-plugin-universal-import - it generates a dependency on the module in webpack (with the weak) flag set.

I've confirmed here that even on the server when import() promises do not create separate chunks, the actual execution of the imported module is still asynchronous in the sense that it occurs after the module importing it has finished executing.

So this flag should prevent generating warnings where there is no risk that imports will be undefined as a result of import cycles.

Comment thread index.js Outdated
this.options = extend({
exclude: new RegExp('$^'),
failOnError: false,
allowAsyncCycles: true,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the default should be false and consumers of this plugin can opt into ignoring these because they are in fact circular.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I've changed it to false by default.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks I'll get this into a 5.1 version

@aackerman aackerman merged commit 2ea27ea into aackerman:master Apr 27, 2018
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 this pull request may close these issues.

2 participants