@baemingo/tscpaths-async

中文文档
0.0.15发布于 2019/12/14MITTypeScriptCommonJS近 30 天下载 1.9万

Replace absolute paths to relative paths after typescript compilation

原始使用文档
文档目录4 节
  1. Comparison to tsconfig-paths
  2. Getting Started
  3. Add it to your build scripts in package.json
  4. Options

tscpaths

Replace absolute paths to relative paths after typescript compilation (tsc) during compile-time.

npm version Dependency Status License

Comparison to tsconfig-paths

+ Compile time (no runtime dependencies)

Getting Started

First, install tscpaths as devDependency using npm or yarn.

npm install --save-dev @baemingo/tscpaths-async
# or
yarn add -D @baemingo/tscpaths-async

Add it to your build scripts in package.json

"scripts": {
  "build": "tsc --project tsconfig.json && tscpaths -p tsconfig.json -s ./src -o ./out",
}

Options

flagdescription
-p --projectproject configuration file (tsconfig.json)
-s --srcsource code root directory
-o --outoutput directory of transpiled code (tsc --outDir)
--silentsilence the console output

You need to provide -s (--src) and -o (--out), because it's hard to predict source and output paths based on tsconfig.json.

I've tried a little and failed. :(

tsc does some magic to determine source and output paths and I haven't dived too deep to mimic it.

For now, it's simpler to provide the paths manually.

If you know how, Pull Requests are welcome!

Disclaimer !!!!!

This is not a mature project yet.

It works for my setup so far.

It may not work correctly if your setup is too complicated, so please do some testing before pushing it to production!!!

版本与发布记录

@baemingo/tscpaths-async 共发布 11 个版本,首次发布于 2019/11/19;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.0.15latest2019/12/146 年前
0.0.142019/11/296 年前
0.0.132019/11/286 年前
0.0.13-alpha.5alpha2019/11/286 年前
0.0.13-alpha.42019/11/286 年前
0.0.13-alpha.32019/11/286 年前

关于 @baemingo/tscpaths-async 的常见问题

@baemingo/tscpaths-async 是什么?

Replace absolute paths to relative paths after typescript compilation

如何安装 @baemingo/tscpaths-async?

在项目目录运行 npm install @baemingo/tscpaths-async,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 tscpaths,可以用 npx tscpaths 直接运行。

@baemingo/tscpaths-async 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@baemingo/tscpaths-async 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@baemingo/tscpaths-async 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=10.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@baemingo/tscpaths-async 可以商用吗?

@baemingo/tscpaths-async 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@baemingo/tscpaths-async 的下载量有多少?

根据 npm 官方下载统计,@baemingo/tscpaths-async 在 2026/10/08 – 2026/11/06 这 30 天内被下载 19,449 次,日均约 648 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@baemingo/tscpaths-async 还在维护吗?

最新版本 0.0.15 发布于 2019/12/14(6 年前);至今共发布 11 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/11/19。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。