Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

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

share|improve this question
up vote 0 down vote accepted

This issue is totaly about my problem. Waiting for Typescript update with moduleResolution: 'target' usage

https://github.com/Microsoft/TypeScript/issues/5039

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.