New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@benyap/tscpaths

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@benyap/tscpaths

Replace absolute paths to relative paths after typescript compilation

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

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

flagshorthandrequireddefaultdescription
--src-syessource directory (where the source code is)
--out-oyesoutput directory of transpiled code (tsc --outDir)
--project-pnotsconfig.jsonpath to the project configuration file (tsconfig.json)
--extnojscomma separated list of extensions to match and replace
--verbosenoshow 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.

Keywords

FAQs

Package last updated on 02 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc