I am working on angular 4 project using gulp in Visual studio 2015.
I got the Visual Studio 2015 QuickStart
from here.
- tsc version: 2.5.2
My project structure:
src
└──angular
└──common
└──models
└──items.ts
└──ui
└──components
└──items.component.ts
items.ts
export module items {
export const listOfItems = [1,2,3];
}
I want to use non-relative path when importing everything within my src folder, i.e.:
items.component.ts
import { items } from 'items';
This is my tsconfig.json
file (which is on the same level as src
):
{
"compileOnSave": false,
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2015", "dom" ],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"node_modules/@types/"
]
}
}
I have tried adding this into the compilerOptions
:
"baseUrl": "." //it doesn't help.
after that:
"baseUrl": ".",
"paths": {
"*": [
"*",
"src/angular/*" // still nothing.
]
}
I also added rootDirs
but I am still getting this error:
Can't find module 'items'