How can I enable the option to transpile non-imported typescript files. In my NestJS project, serverless framework skips typeorm migration files as they are not imported anywhere in project. I can make it work by manually importing migrations in one of the file.
Is there any option in tsconfig.json that automatically transpile non-imported file?
Here is my tsconfig.json file.
{
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"allowJs": true,
"declaration": true,
"sourceMap": true,
"outDir": "./dist",
"removeComments": true,
"baseUrl": "./",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
}
My typeorm migration files are located in src/migrations directory and they run automatically as migrationsRun is true.
import { TypeOrmModuleOptions } from "@nestjs/typeorm";
import { join } from "path";
export const typeOrmConfig: TypeOrmModuleOptions = {
type: 'mysql',
host: 'localhost',
port: 3306,
username: 'root',
password: 'password',
database: 'database_name',
entities: [join(__dirname, './../**/**.entity{.ts,.js}')],
migrations: [join(__dirname, './../migrations/*{.ts,.js}')],
cli: {
migrationsDir: 'src/migrations',
},
synchronize: false,
// Run migrations automatically,
migrationsRun: true,
logging: true,
};
My migrations directory is src/migrations but they do not transpile into dist/src/migrations directory when I deploy via Serverless framework.