Import crypto-js in an angular 2 project (created with angular-cli)
<p>I'm trying to import crypto-js in my angular2 project.</p>

<p>I followed several SO questions and also <a href="https://github.com/angular/angular-cli/wiki/3rd-party-libs" rel="noreferrer">angular-cli guide</a>, but at the end I still have the error <strong>Cannot find module 'crypto-js'</strong></p>

<p>What I tried :</p>

<p><code>npm install crypto-js --save</code></p>

<p>and</p>

<p><code>typings install dt~crypto-js --global --save</code></p>

<p>then I modified the file <strong>angular-cli-build.js</strong></p>

<pre><code>var Angular2App = require('angular-cli/lib/broccoli/angular2-app');

module.exports = function(defaults) {
  return new Angular2App(defaults, {
    vendorNpmFiles: [
      'systemjs/dist/system-polyfills.js',
      'systemjs/dist/system.src.js',
      'zone.js/dist/**/*.+(js|js.map)',
      'es6-shim/es6-shim.js',
      'reflect-metadata/**/*.+(ts|js|js.map)',
      'rxjs/**/*.+(js|js.map)',
      '@angular/**/*.+(js|js.map)',
      'crypto-js/**/*.+(js|js.map)'
    ]
  });
};
</code></pre>

<p>and the file <strong>src/system-config.ts</strong></p>

<pre><code>const map: any = {
    'crypto-js': 'vendor/crypto-js'
};

/** User packages configuration. */
const packages: any = {
    'crypto-js': {
        format: 'cjs'
    }
};
</code></pre>

<p>After using</p>

<p><code>import * as CryptoJS from 'crypto-js';</code></p>

<p>I still have my error. Did I miss something ?</p>

<p>Thanks</p>