I have used relative Paths
to import modules created in my Angular2
and TypeScript
application.
Example (Source Code)
import {Http} from 'angular2/http';
import {Injectable} from 'angular2/core';
import {Person} from '../core/Person';
This compiles fine on windows (tsc v1.7.5) but is not able to load on Linux.
Questions:
- Why is this behaving so on linux?
- Is there a standard way to declare path of modules in typescript?
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"wwwroot/lib"
]
}
Error on Ubuntu 14.04
wwwroot/app/people/people.service.ts(3,22): error TS2307: Cannot find module '../core/Person'. wwwroot/app/routes.config.ts(1,22): error TS2307: Cannot find module './home/Home'. wwwroot/app/routes.config.ts(2,23): error TS2307: Cannot find module './about/About'. wwwroot/app/routes.config.ts(3,24): error TS2307: Cannot find module './people/People'. wwwroot/app/routes.config.ts(4,30): error TS2307: Cannot find module './people/PersonDetail'.
As you can see from sourcecode on github, Person.ts contains the class person located in wwwroot\app\core\Person.ts
Please help me resolve this issue. Thanks in advance.
I found the problem.
Windows ignores case in directory & file names whereas linux does not.
After keeping all folder and file names in small case and replicating the same in imports. It compiled successfully.