Closed
Description
Hello,
I'm trying to use paths property in my tsconfig.json file.
It makes the build work perfectly but execution of generated js is failing.
My tsconfig.json:
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist",
"baseUrl": "./src",
"paths": {
"core/*": [
"core/*"
]
},
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
]
},
"include": [
"src/**/*"
]
}
src/core/service.ts:
export class Service {
public static log(message: string) {
console.log('message', message);
}
}
src/core/index.ts:
export * from './service';
src/index.ts:
import { Service } from 'core';
Service.log('test');
The build is working perfectly
But running dist\index.js I obtain:
Error: Cannot find module 'core'
Am I doing something wrong?
I made a repo to illustrate this:
https://github.com/BUONJG/typescript-paths.git
Many thanks for your support,
Jean-Guy