Skip to content

ESM: avoid critical dependency webpack warning #1901

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

Merged
merged 3 commits into from
May 10, 2021

Conversation

floryst
Copy link
Collaborator

@floryst floryst commented May 7, 2021

Context

When using the @kitware/vtk.js package, webpack users would run into a Critical dependency warning, like the one below.

WARNING in ./node_modules/@kitware/vtk.js/_virtual/commonjsHelpers.js 154:8-29
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/@kitware/vtk.js/_vendor/readable-stream/lib/_stream_duplex.js_commonjs-dynamic-register 4:0-77 6:0-16
 @ ./node_modules/@kitware/vtk.js/Rendering/Core/Actor.js 2:0-87
 @ ./src/index.js 10:0-60 50:14-34

Changes

We switch to using the polyfill rollup plugin in order to polyfill out stream (and readable-stream).

Results

Initial testing indicates that the polyfill works and the error does not occur in webpack builds that consume @kitware/vtk.js.

@floryst floryst requested a review from jourdain May 7, 2021 22:27
@floryst floryst changed the title ESM: avoid critical dependency webpack error ESM: avoid critical dependency webpack warning May 7, 2021
@floryst floryst merged commit 41f99e1 into Kitware:master May 10, 2021
@floryst floryst deleted the update-esm-build branch May 10, 2021 16:50
@github-actions
Copy link

🎉 This PR is included in version 18.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot added the released Automated label label May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Automated label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants