[英]Using tsconfig-paths with a project?
I'd like to setup tsconfig-paths for this project .我想为这个项目设置tsconfig-paths 。
I'm not sure what I need to do after installing tsconfig-paths
as a dev dependency.在将tsconfig-paths
作为开发依赖项安装后,我不确定我需要做什么。
Thoughts?想法?
The plugin has to be registered dynamically via the command line for each script that is run.必须通过命令行为每个运行的脚本动态注册插件。 For example I have a data generate script in test/data/generate/index.ts
.例如,我在test/data/generate/index.ts
有一个数据生成脚本。 In order to run this script, which imports from @fs/utilities
I need to do:为了运行这个从@fs/utilities
导入的脚本,我需要执行以下操作:
npx ts-node -r tsconfig-paths/register test/data/generate/index.ts
For my use cases this is enough as I have few scripts that need to be run dynamically inside the typescript project.对于我的用例,这已经足够了,因为我几乎没有需要在 typescript 项目中动态运行的脚本。 For example for @fireflysemantics/validator everything exported is intended to be used by external dependencies, thus there are no cases where I need to run data generation scripts.例如,对于@fireflysemantics/validator,导出的所有内容都旨在供外部依赖项使用,因此我不需要运行数据生成脚本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.