Let's suppose I've a project, and its main source directory is:
C:\product\src
Based on this directory, every import path would be relative to it. I.e., suppose:
// Current script: C:\product\src\com\name\product\blah.ts
import { thing } from '/com/name/product/thing';
same as:
// Current script: C:\product\src\com\name\product\blah.ts
import { thing } from '../../../com/name/product/thing';
My entry compilation file would be at:
C:\product\src
for instance. So, is there a way to specify this such entry path (C:\product\src
, for example) at the compiler options? I need to specify this in the tsconfig.json
file, because I'll use webpack.
I've tried my above example, but TypeScript says the requested module cannot be found:
// Current script: A.ts
import { B } from '/com/B';
// Current script: B.ts
export const B = 0;
My tsconfig.json file (inside another project, but both similiar):
{
"compilerOptions": {
"module": "commonjs",
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"preserveConstEnums": true,
"removeComments": true,
"sourceMap": true,
"strictNullChecks": true,
"target": "ES6"
},
"include": [
"./src/**/*.ts",
"./src/**/*.d.ts"
]
}