【发布时间】:2022-11-05 18:52:40
【问题描述】:
我正在尝试运行迁移。我的 Knexfile 是用 Typescript 编写的,其中一些路径别名来自 tsonfig.json,但 Knex 以 Cannot find module '@foo-alias/bar-module' 失败。我需要在运行 Knex migrate 的方式或我的 TS 配置中进行哪些更改才能使其正常工作?
根据我在网上看到的一些线程,我尝试过使用这样的东西,但没有骰子:
TS_NODE_PROJECT=tsconfig.knexfile.json knex migrate:latest
{
"compilerOptions": {
...a bunch of compiler options here
"paths": {
"@foo-alias/*": ["src/foo/*"]
}
},
"exclude": ["node_modules"]
}
【问题讨论】:
标签: node.js typescript database-migration knex.js npm-scripts