-
Notifications
You must be signed in to change notification settings - Fork 12k
Angular 12: No way to provide missing node shims used in libraries #20821
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
Comments
I just found this workaround: #20819 (comment), where I added an empty file to simulate |
The path mappings work for all TypeScript and JavaScript files bundled within the application including npm libraries. It is also recommended to avoid libraries that rely on Node.js specific APIs and prefer browser libraries where possible. |
Indeed you're right, I've just messed up with |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 Bug report
Command (mark with an
x
)Is this a regression?
Yes, the previous version in which this bug was not present was: 11.2Description
The problem is mentioned in the issue #20731 (comment). But since those comments were marked as off-topic, I'm creating a separate issue for this. The solution mentioned by @clydin (#20731 (comment)) (installing shim packages, e.g.
crypto-browserify
, and specifying it inpaths
section oftsconfig.json
) works within the project code but not for the npm libraries.Just to recap, the question is: how can I provide Node.js shims to resolve
crypto
,stream
and other modules in Angular 12 if those modules are referred in npm packages (outside of project code)? There's no clear way to follow instruction mentioned in error logs (I mean addingresolve.fallback
) since the webpack config isn't exposed in Angular, and I would prefer to avoid using custom angular builders e.g. https://github.com/just-jeb/angular-builders.🔥 Exception or Error
🌍 Your Environment
The text was updated successfully, but these errors were encountered: