1

I'm using Angular and I've just added a library to my main project, so I went to package.json, added

"@lo/lib-common-mylib": "^0.0.250"

did an npm install and I had no problem so far.

When I go into my component and wrote

import {utils} from '@lo/lib-common-mylib';

I still have no problem, but as soon as I go in the constructor and wrote

private regionalHelper: utils.RegionalHelper

I receive this error:

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
        - install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "crypto": false }

I have crypto installed in the common-lib imported, but unlike the others questions similar to this, I don't have webpack installed, so I have no webpack.config.js; and mainly I'm working on Angular, not on React.

I've tried to follow these steps: https://github.com/angular/angular-cli/issue

like installing path-browserify and add it into tsconfig, but it's not working.

Any suggestion? Thanks a lot!

Asder999
  • 87
  • 1
  • 7

0 Answers0