Sh *_*eeb 6 node.js typescript tsconfig ts-node tsconfig-paths
我有一个使用 commonjs 模块的打字稿项目,我用ts-node它来运行它并在运行时tsconfig-paths解析tsconfig.compilerOptions.paths。
现在我希望我的项目迁移到使用es模块,所以我做了一些更改:
type: module到 package.jsonmodule: commonjs为ES2022tsconfig.jsonts-node为node --loader ts-node/esm现在一切都工作正常,但似乎tsconfig-paths在 esm 中不起作用。
最小复制品:
es 模块项目,从 commonjs 项目派生出来,但经过修改以使用 es 模块
在这两个项目中:
npm run build以测试使用带有 esm 的 typescript 进行编译npm start测试ts-nodenpm start:paths测试ts-nodetsconfig-paths| 归档时间: |
|
| 查看次数: |
1526 次 |
| 最近记录: |