无法在生产中迁移和运行种子。knex 尝试运行 ts 文件但失败。控制台错误:
Cannot use import statement outside a moduleD:\web-projects\product-feedback\dist\src\db\migrations\20211215210852_initial.d.ts:1
import { Knex } from 'knex';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:979:16)
at Module._compile (internal/modules/cjs/loader.js:1027:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at importFile (D:\web-projects\product-feedback\node_modules\knex\lib\migrations\util\import-file.js:12:7)
at async D:\web-projects\product-feedback\node_modules\knex\lib\migrations\migrate\Migrator.js:87:15
at async Promise.all (index 0)