This package has been deprecated

Author message:

WARNING: This package has been renamed to resolve-tspaths. Install resolve-tspaths instead.

@benyap/tscpaths
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

This package is deprecated

Please use resolve-tspaths instead! It is a rewrite and tested version of this package.


@benyap/tscpaths

This is a fork of joonhocho's tscpaths. Credit goes to joonhocho for the original code.

npm version Dependency Status License

If you use Typescript's path mapping feature (by setting baseUrl and paths in tsconfig.json), you may have found that transpiling with tsc doesn't convert your aliases to proper relative paths. This causes problems as the transpiled code can't actually run with those path aliases - you'll get a "module not found" error.

Use this package after tsc transpilation to replace path aliases with relative paths so that you can develop using path aliases whilst still being able to ship working JavaScript code.

Comparison to tsconfig-paths

  • Use during compile time - no runtime dependencies!

Usage

  1. Install @benyap/tscpaths as a dev dependency using npm or yarn.

    npm install --save-dev @benyap/tscpaths
    # or
    yarn add -D @benyap/tscpaths
  2. Add it as a part of your build script in package.json after the code has been transpiled.

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

Options

flag shorthand required default description
--src -s yes source directory (where the source code is)
--out -o yes output directory of transpiled code (tsc --outDir)
--project -p no tsconfig.json path to the project configuration file (tsconfig.json)
--ext no js comma separated list of extensions to match and replace
--verbose no show verbose output

Disclaimer

This is not a mature nor is it a well tested project. It works for some personal use cases. Feel free to fork or submit pull requests.

Package Sidebar

Install

npm i @benyap/tscpaths

Weekly Downloads

3

Version

0.1.2

License

MIT

Unpacked Size

56.5 kB

Total Files

77

Last publish

Collaborators

  • bwyap
  • benyap