Suppose I have a project and its main source directory:
C:\product\src
Based on this directory, each import path will relate to it. Ie, 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 compilation file will look like this:
C:\product\src
eg. So, is there a way to specify this input path ( C:\product\src , for example) in the compiler options? I need to specify this in the tsconfig.json file because I will use webpack.
I tried my example above, but TypeScript says the requested module was not 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 are alike):
{ "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" ] }
user7536774
source share