I have set up an Angular 2 project using the starter sample. Code is placed under the apps directory, ts compiles to js in the same structure and lite-server serves files correctly. All works correctly.
I'd like to move the ts output to a dist directory as I don't like js & map files in the same structure (this is pretty common in other environments).
Adding
"outDir": "dist"
to the tsconfig.json file does cause the ts to be compiled into .js under the dist/app/app directory. Not sure why this adds a second app to the structure.
Through trial and error testing, seems basedir = "./" works for the old structure. Not sure why this works but it does.
Using bs-config.js
module.exports = {
port: 3000,
server: {
// old structure, this works
baseDir: "./"
// new structure commented out, does not work
//baseDir: "./dist"
}
};
Have played with this a while but can't get the dist structure to serve files.
Always get a "Cannot GET /" response.
My tsconfig.json file:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true,
"outDir": "dist"
}
}
Would appreciate if someone could explain my findings and what I am missing.