Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript Tsconfig,当我使用多个rootdir时,如何在build-to-dist中展平结构src文件_Typescript_Nestjs_Typeorm - Fatal编程技术网

Typescript Tsconfig,当我使用多个rootdir时,如何在build-to-dist中展平结构src文件

Typescript Tsconfig,当我使用多个rootdir时,如何在build-to-dist中展平结构src文件,typescript,nestjs,typeorm,Typescript,Nestjs,Typeorm,我有类型为orm的nest js应用程序和文件数据库迁移。Windows的实际值。 我需要从src进行扁平化结构以构建dist,然后添加文件夹迁移。 我有这个结构: project/ tsconfig.json tsconfig.build.json ormconfig.js migrations/ **.file.ts src/ app.module.ts main.ts common/ modules/ 我需要建立: dist

我有类型为orm的nest js应用程序和文件数据库迁移。Windows的实际值。 我需要从src进行扁平化结构以构建dist,然后添加文件夹迁移。 我有这个结构:

project/
  tsconfig.json
  tsconfig.build.json
  ormconfig.js
  migrations/
    **.file.ts
  src/
    app.module.ts
    main.ts
    common/
    modules/
我需要建立:

dist
  migrations/
  common/
  modules/
  app.module.d.ts
  app/module.js
  main.d.ts
  main.js
但我有:

dist
  migrstions/
  src/
  tsconfig.build.tsbuildinfo
我的tsconfig.json文件:

{
  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es6",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "rootDir": ".",
    "rootDirs": ["./src/*"]
  },
  "exclude": ["node_modules"]
}
我的ormconfig.js

module.exports = {
  type: process.env.DB_TYPE,
  host: process.env.DB_HOST,
  port: process.env.DB_PORT,
  username: process.env.DB_USERNAME,
  password: process.env.DB_PASSWORD,
  database: process.env.DB_NAME,
  entities: ['src/**/entities/index.ts'],
  migrations: ['migrations/*.ts'],
  migrationsRun: false,
  synchronize: false,
  cli: {
    migrationsDir: 'migrations',
  },
  charset: 'utf8mb4',
};
T尝试在tsconfig:(按解决方案)中添加路径,但它对我不起作用

"compilerOptions": {
   ...
   "rootDir": "./src",
   "paths": {
      "@app/migrations": ["./migrations"]
    }
   ...
}

是否可以为这种结构配置tsconfig,或者唯一的解决方案是将migrations文件夹传输到src?

是否尝试从tsconfig中删除
“rootDirs”:[“/src/*”]
?是的,我尝试使用此配置,但结果相同<代码>{“编译器选项”:{“模块”:“commonjs”,“声明”:true,“removeComments”:true,“emitDecoratorMetadata”:true,“实验记录器”:true,“目标”:“es6”,“源映射”:true,“outDir”:“/dist”,“baseUrl”:“/”,“增量”:true},“排除”:[“节点模块”]}