I am trying to configure SystemJS for an existing AngularJS + Typescript application.
I have a problem with module loading: When I use this syntax:
import module1 from './path-to-module1'
TS compiler is happy but SystemJS will not find this module. After a little investigation I found this, on SystemJS documentation:
System.defaultJSExtensions = true;
// requests ./some/module.js instead
System.import('./some/module');
Cool, now both TS compiler and SystemJS work. But, SystemJS documentations says:
Note that this is a compatibility property for transitioning to using explicit extensions and will be deprecated in future.
So, I figured out that I should add a .js extention to my module loading, like this (removing the 'defaultJSExtensions = true' flag):
import module1 from './path-to-module1.js'
Now SystemJS knows how to load my module, by TS compiler says:
Cannot find module './path-to-module1.js'
How can I make TS figure this out? Should I manually add all my modules to a *.d.ts file? How?
10x!
EDIT
I found this post, which I guess should be what I need to do. I found this on my Grunt file:
typescript: {
build: {
src: ...,
outDir: '...',
reference: 'reference.ts',
options: {
target: 'es5',
sourceMap: false,
declaration: false,
removeComments: false,
experimentalDecorators: true,
module: 'commonjs'
}
}
}
But, changing the commonjs to system did not help hree..