I'm pretty new with Angular and systemjs, but I'll try to be more specific as possible.
I'm working with angularjs2 and typescript. I compile my .ts files with a tsconfig.json. Here is my config:
Next, I want to bootstrap my application through my index.html with systemjs. But my import doesn't accept init without extension (below, my init, that actually work) :
System.config({
transpiler: 'typescript'
});
System.import('src/app.ts');
I'm forced to mention the .ts extension (same problem in ts files when I want to import handmade components).
Am I forgetting something? Documentation is a bit rough for beginners concerning first configurations.
Moreover, I've got all my scripts called in <head>
(system.js, typescript.js, angular2.dev.js)
I had a similar issue, only difference is that I'm not using angular
@Nicolas pointed into the right direction, you need to add "defaultExtension", for me the following configuration did the trick:
packages: {
'.': {
defaultJSExtensions: 'js'
}
},
You can find out more about how to configure systemjs on github
UPDATE: comment from Dai:
Since systemjs 0.19 the property is defaultExtension and it defaults to *.js, so it isn't necessary to define packages members unless you're using non-default settings.
I'm study the new version of AngularJS and everytime that I needed to set up t SystemJS I use this configuration in my index page.
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
}
});
You need say what is your extension file to SystemJS load your modules, I hold it helped you.
On the angularjs Quickstart they do not mention that the packages names MUST match. I took me a while to figure it out.
System.config({
packages: {
WHATEVER: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('WHATEVER/app');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With