Have one interesting issue with System.js and Angular 2.
In default quickstart we have this system config:
System.config({
packages: {
built: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('built/main')
.then(null, console.error.bind(console));
It's works for me. But now I try to move all files from built upp. So main.js file on one level with index.html. So for now system package can't be deployed. Because thy need some folder name (all node_modules installed correctly on the root folder with all angular2 stuffs).
And I try to use some simple config:
System.config({
defaultJSExtensions: true
});
System.import('main')
.then(null, console.error.bind(console));
but got many errors like this:
system.src.js:1061 GET http://localhost:3000/angular2/platform/browser.js 404 system.src.js:1061 GET http://localhost:3000/angular2/router.js 404 (Not Found)
Thanks for any help!
I think that you forgot to include the Angular2 bundled files:
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="node_modules/angular2/bundles/router.dev.js"></script -->
Because SystemJS can find modules they contain, it tries to load from .js since you set the defaultJSExtensions
attribute is set to true
in its configuration.