I'm trying to write basic app with angular2/systemjs/typescript with modularity that i used with angular1, and have some problems.
I need this thing anywhere in my app without depending on the relative location of files, where smth-module
is any module that i wrote and contains(exports) SmthCmp
class
import SmthCmp from 'smth-module';
Test app sctructure
├── bootstrap.ts
├── graph-module
│ ├── component
│ │ └── line-graph
│ │ └── line-graph.ts
│ └── index.ts
└── page-module
├── component
│ └── page
│ └── page.ts
└── index.ts
bootstrap.ts
...
import {PageCmp} from 'page-module/index';
bootstrap(PageCmp, [
...
]);
page.ts
...
import {LineGraphCmp} from 'graph-module/index';
...
export class PageCmp {}
line-graph.ts
...
export class LineGraphCmp {}
graph and page modules indexes like this
export {PageCmp} from './component/page/page';
also added to System.config()
map: {
'graph-module': '/graph-module',
'page-module': '/page-module'
}
So i can use export Smth from 'module/index'
syntax anywhere and this is almost what i need. But there is one problem
app/bootstrap.ts(4,23): error TS2307: Cannot find module 'page-module/index'.
app/page-module/component/page/page.ts(8,28): error TS2307: Cannot find module 'graph-module/index'.
How can i tell Typescript compiler about this modules? Or can i achive this modules usage via other way or modules system?
Also can i somehow achive this usage import {PageCmp} from 'page-module'
without direct '/index' reference?
p.s. this is copypaste from my last question at this discussion