1.0.1 • Published 2 years ago

@diegovictor/tsc-path-replacer v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

tsc-path-replacer

npm eslint prettier airbnb-style typescript MIT License PRs Welcome

Resolve imports/requires alias according to tsconfig paths. It tries use more resources provided by Node.js, like, asynchronous methods, paralelism and a simple memory cache.

Examples

// ./src/controllers/user/index.js

// this import:
import userService from '@services/user/getUsers';
// will be replaced by:
import userService from '../../services/user/getUsers';

Using require:

// ./src/controllers/user/index.js

const userService = require('@services/user/getUsers');
const userService = require('../../services/user/getUsers');

The biggest difference from this package to another similar ones is the huge usage of the Node.js asynchronous APIs and paralelism (up to 5 files are processed at the same time).

Table of Contents

Installing

Just run:

npm install --save-dev @diegovictor/tsc-path-replacer

Or simply:

yarn add -D @diegovictor/tsc-path-replacer

Usage

Register on your build script:

"scripts": {
  "build": "tsc --project tsconfig.json && tsc-path-replacer tsconfig.json",
}

Inspired by

tsconfig-replace-paths

1.0.1

2 years ago

1.0.0

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago