我试图开始使用npm angular2-oauth2包: https://www.npmjs.com/package/angular2-oauth2
我在systemjs.config.js中包含了几个依赖项:
// map tells the System loader where to look for things
var map = {
'app': 'app', // 'dist',
'@angular': 'node_modules/@angular',
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
'rxjs': 'node_modules/rxjs',
'angular2-oauth2': 'node_modules/angular2-oauth2', // <- library I'm trying to use
'base64-js': 'node_modules/base64-js/lib/b64.js',
'js-base64': 'node_modules/js-base64/base64.min.js', // <- Problem here
'sha256': 'node_modules/sha256/lib/sha256.js',
'convert-hex': 'node_modules/convert-hex/convert-hex.js',
'convert-string': 'node_modules/convert-string/convert-string.js'
};
我试图加入&#34; js-base64&#34;库,打开页面时出现异常:
zone.js:101 GET http://localhost:3000/buffer 404 (Not Found)
如何导入此库?
答案 0 :(得分:0)
在包含更多库之后,它起了作用。我不明白为什么angular不会自动解析angular2-oauth2插件本身的依赖关系。这是工作申报地图:
var map = {
'app': 'app', // 'dist',
'@angular': 'node_modules/@angular',
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
'rxjs': 'node_modules/rxjs',
'angular2-oauth2': 'node_modules/angular2-oauth2',
'base64-js': 'node_modules/base64-js/lib/b64.js',
'js-base64': 'node_modules/js-base64/base64.js',
'sha256': 'node_modules/sha256/lib/sha256.js',
'convert-hex': 'node_modules/convert-hex/convert-hex.js',
'convert-string': 'node_modules/convert-string/convert-string.js',
'buffer': 'node_modules/buffer/index.js', // added
"ieee754": "node_modules/ieee754/index.js", // added
"isarray": "node_modules/isarray/index.js" // added
};