I need the modules to be solved based on baseUrl , so the output code can be used for node.js
this is my src/server/index.ts
import express = require('express'); import {port, databaseUri} from 'server/config'; ...
and this is my src/server/config/index.ts
export const databaseUri: string = process.env.DATABASE_URI || process.env.MONGODB_URI; export const port: number = process.env.PORT || 1337;
Running tsc I can compile all files without erros, but the output: dist/server/index.js is
"use strict"; var express = require("express"); var config_1 = require("server/config"); ...
As a result, using Cannot find module 'server/config' if I try to use it with node dist/sever/index.js .
Why the server/config path is not resolved in any way, so one could use the compiled code or how to resolve it. Or what am I doing or thinking wrong?
My tsc --version - 2.1.4
This is my tsconfig.json :
{ "compileOnSave": true, "compilerOptions": { "baseUrl": "./src", "rootDir": "./src", "module": "commonjs", "target": "es5", "typeRoots": ["./src/types", ".node_modules/@types"], "outDir": "./dist" }, "include": [ "src/**/*" ], "exclude": [ "node_modules", "**/*.spec.ts" ] }
Note. I do not want to use the ../../../../relative paths.