我尝试了许多指定路径的变体,以允许SystemJS加载ngx-bootstrap包
System.config({
"defaultJSExtensions": true,
"paths": {
"@angular/core": "node_modules/@angular/core/bundles/core.umd.js",
"@angular/forms": "node_modules/@angular/forms/bundles/forms.umd.js",
"@angular/http": "node_modules/@angular/http/bundles/http.umd.js",
...
"*": "node_modules/*",
"ngx-bootstrap": "node_modules/ngx-bootstrap",
"highcharts": "node_modules/highcharts/highcharts.js",
"angular2-highcharts": "node_modules/angular2-highcharts/index.js"
},
"packages": {}
});
但它仍然无法正常加载..
我在控制台中看到以下错误
"(SystemJS) XHR error (404 Not Found) loading http://localhost:5555/node_modules/ngx-bootstrap.js
wrapFn@http://localhost:5555/node_modules/zone.js/dist/zone.js?1493823577322:1230:30 [<root>]
Error loading http://localhost:5555/node_modules/ngx-bootstrap.js as "ngx-bootstrap" from http://localhost:5555/hc/app.module.js"
"Not expecting this error? Report it at https://github.com/mgechev/angular-seed/issues"
答案 0 :(得分:5)
你错过了这一部分:
packages: {
//... other code
'ngx-bootstrap': { format: 'cjs', main: 'bundles/ngx-bootstrap.umd.js', defaultExtension: 'js' },
}