Hi all,
I'm trying to follow style guideline 04-10 Create and Import Barrels at
https://angular.io/docs/ts/latest/guide/style-guide.html
My code compiles just fine but when I try to run my app it throws a 404
error. It is looking for a file that does not exist. For some reason
angular is looking for a file that I don't reference anywhere.
For example:
I have a component at app/component1/component1.component.ts. The app is
now trying to load a file called app/component1/component1.ts. I never
reference a file with this name in my code. I just use the barrel import
like it recommends in the style guide by just importing the folder.
1. import {
2. CONFIG,
3. EntityService,
4. ExceptionService,
5. FilterTextComponent,
6. InitCapsPipe,
7. SpinnerService,
8. ToastService
9. } from '../shared';
I'm using the systemjs.config.js from that sample apps:
/**
* System configuration for Angular 2 samples
* Adjust as necessary for your application needs.
* Override at the last minute with global.filterSystemConfig (as plunkers
do)
*/
(function(global) {
// map tells the System loader where to look for things
var map = {
'app': '/angular/apps/xion-admin', // 'dist',
'rxjs': '/components/rxjs',
'angular2-in-memory-web-api': '/components/angular2-in-memory-web-api',
'@angular': '/components/@angular'
};
// packages tells the System loader how to load when no filename and/or
no extension
var packages = {
'app': { main: 'main.js', defaultExtension:
'js' },
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { defaultExtension: 'js' },
};
var packageNames = [
'@angular/common',
'@angular/compiler',
'@angular/core',
'@angular/http',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/router',
'@angular/testing',
'@angular/upgrade',
];
// add package entries for angular packages in the form
'@angular/common': { main: 'index.js', defaultExtension: 'js' }
packageNames.forEach(function(pkgName) {
packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
});
var config = {
map: map,
packages: packages
};
System.config(config);
})(this);
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.