I am using the microservice hybrid example from nestjs (https://github.com/nestjs/nest/tree/master/sample/03-microservices) to get familiar with the basics. It currently uses a microservice that is located inside the src folder (src/math). I want to move the microservice in the root folder under a microservices folder (microservices/math/...) so that can build additional ones in this structure.
When i run it with "start:prod": "node dist/main.js" if the math.module I am importing in the app.module.ts is the one as per example, in './math/math.module' it works fine. If I copy the math folder content in the microservices folder in the root and i reference the math.module from '../microservices/math.module' then the dist structure is wrong where I have:
- dist
- microservices
- src
- common
- math
- app.module.d.ts
- main.d.ts
Of course, in this case, it will try to run main.js inside "dist" but it's no longer there it's it is automatically put inside the src rather than being in the root of the dist folder.
Is this purely a typescript configuration that i need to tweak?
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"noImplicitAny": false,
"removeComments": true,
"noLib": false,
"allowSyntheticDefaultImports": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es6",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./"
},
"exclude": ["node_modules"]
}
tsconfig.build.json
{
"extends": "./tsconfig.json",
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"]
}