Ok, let me answer my own question. This is really strange. I have changed the value of rootDir
on my tsconfig.json
file to .
, that solved the issue here. This post really helped me to do so. I am not sure what is the relation ng build --prod
has with this rootDir
. Now all the commands are working fine.
Previous tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"module": "commonjs",
"target": "ES5",
"outDir": "bin",
"rootDir": "src",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}
New tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"module": "commonjs",
"target": "ES5",
"outDir": "bin",
"rootDir": ".",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}

Hope it helps.