I am trying to import crypto-js into an angular2 project.
I have completed some SO questions as well as angular-cli guide , but in the end I still have an error. Cannot find the module 'crypto-js'
What I tried:
npm install crypto-js --save
and
typings install dt~crypto-js --global --save
then I changed the angular-cli-build.js file
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)' ] }); };
and src / system-config.ts file
const map: any = { 'crypto-js': 'vendor/crypto-js' }; const packages: any = { 'crypto-js': { format: 'cjs' } };
After use
import * as CryptoJS from 'crypto-js';
I still have my mistake. Did I miss something?
thanks
source share