title: Using native crypto module in Angular app
body: <p>A recent update to <a href="https://github.com/brix/crypto-js" rel="nofollow noreferrer">crypto-js</a> library switches to using native crypto module of the underlying OS, as I understand it.</p>
  
  <p>As a result, my build fails (verbose output below) if I use the updated version, as it seems it is not wired in the default Angular webpack config.</p>
  
  <p>How to make <code>crypto-js</code> find it?</p>
  
  <p><a href="https://github.com/angular/angular-cli/issues/1548#issuecomment-415477535" rel="nofollow noreferrer">This comment</a> is enlightning, but I don't know enough of the underlying libraries concepts to navigate by myself.</p>
  
  <pre><code>WARNING in ./node_modules/crypto-js/core.js
  Module not found: Error: Can't resolve 'crypto' in '/tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto-js'
  resolve 'crypto' in '/tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto-js'
    Parsed request is a module
    using description file: /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto-js/package.json (relative path: .)
      Field 'browser' doesn't contain a valid alias configuration
      resolve as module
        looking for modules in /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8
          using description file: /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/package.json (relative path: .)
            Field 'browser' doesn't contain a valid alias configuration
            using description file: /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/package.json (relative path: ./crypto)
              no extension
                Field 'browser' doesn't contain a valid alias configuration
                /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/crypto doesn't exist
              .ts
                Field 'browser' doesn't contain a valid alias configuration
                /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/crypto.ts doesn't exist
              .tsx
                Field 'browser' doesn't contain a valid alias configuration
                /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/crypto.tsx doesn't exist
              .mjs
                Field 'browser' doesn't contain a valid alias configuration
                /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/crypto.mjs doesn't exist
              .js
                Field 'browser' doesn't contain a valid alias configuration
                /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/crypto.js doesn't exist
              as directory
                /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/crypto doesn't exist
        /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto-js/node_modules doesn't exist or is not a directory
        /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/node_modules doesn't exist or is not a directory
        /tmp/node_modules doesn't exist or is not a directory
        /node_modules doesn't exist or is not a directory
        looking for modules in /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules
          using description file: /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/package.json (relative path: ./node_modules)
            Field 'browser' doesn't contain a valid alias configuration
            using description file: /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/package.json (relative path: ./node_modules/crypto)
              no extension
                Field 'browser' doesn't contain a valid alias configuration
                /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto doesn't exist
              .ts
                Field 'browser' doesn't contain a valid alias configuration
                /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto.ts doesn't exist
              .tsx
                Field 'browser' doesn't contain a valid alias configuration
                /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto.tsx doesn't exist
              .mjs
                Field 'browser' doesn't contain a valid alias configuration
                /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto.mjs doesn't exist
              .js
                Field 'browser' doesn't contain a valid alias configuration
                /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto.js doesn't exist
              as directory
                /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto doesn't exist
  </code></pre>