在编译我的应用程序时,我得到了以下错误。直到最近(我这边没有任何变化),它一直运作得很好。我搜索了与RXJS目录更改有关的论坛,并在可能的情况下进行了修复,但每次修复都会得到另一个错误:(。
Systemjs.config.js
(function (global) {
System.config({
paths: {
'npm:': 'https://unpkg.com/'
},
map: {
'app': 'app',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
// other libraries
'rxjs': 'npm:rxjs', //see------https://github.com/ReactiveX/rxjs/issues/2971
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
},
packages: {
'app': {
main: '/Shop/Components/main.js',
defaultExtension: 'js',
meta: {
'./*.js': {
loader: '/scripts/systemjs-angular-loader.js'
}
}
},
'rxjs': { defaultExtension: 'js' },
'rxjs/operators': { defaultExtension: 'js' }
}
});
})(this);Main.ts
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";
import { AppModules } from './AppModules.js';
platformBrowserDynamic().bootstrapModule(AppModules)
.then(success => console.log(`Bootstrap success`))
.catch(err => console.error(err));我将我的npm路径指向unpkg.com,因为这更适合我,而不是node_modules,所以对此错误的任何其他建议/修复都将是一个很大的帮助。
发布于 2018-05-16 12:36:32
对于与Systemjs.config.js有类似问题的人来说,答案是将版本号添加到您的角包中。
示例:
'npm:@angular/module@x.x.x/bundles/xxxx.umd.js',如果有依赖冲突的话,这对我有效。
https://stackoverflow.com/questions/50350463
复制相似问题