0

When trying to migrate from Angular 14 to 15 we found the next issue after doing a ng update @angular/core@15 @angular/cli@15 and running ng serve:

./node_modules/asmcrypto.js/asmcrypto.all.es8.js:3572:23-40 - Error: Module not found: Error: Can't resolve 'crypto' in 'C:\projects\ms-front\node_modules\asmcrypto.js'

    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 read somewhere that we should modify the webpack.config file but our project doesn't have such a file.

Note that crypto-browserify is indeed a dependency of my project and it is already downloaded in node_modules

Gonzalo Diaz Ailan
  • 583
  • 1
  • 5
  • 23
  • 1
    Does this answer your question? [webpack 5 angular polyfill for node.js crypto-js](https://stackoverflow.com/questions/67572355/webpack-5-angular-polyfill-for-node-js-crypto-js) – JSON Derulo Apr 05 '23 at 12:18
  • @JSONDerulo I tried the answers provided in that thread but neither modifying tsconfig.json and angular.json neither installing crypto-browserify stream-browserify assert stream-http https-browserify os-browserify with the tsconfig.json modifications did work – Gonzalo Diaz Ailan Apr 05 '23 at 12:51

0 Answers0