Gathering detailed insights and metrics for tsc-alias
Gathering detailed insights and metrics for tsc-alias
Gathering detailed insights and metrics for tsc-alias
Gathering detailed insights and metrics for tsc-alias
tscpaths
Replace absolute paths to relative paths after typescript compilation
rollup-plugin-tsc-alias
Replace alias paths with relative paths after typescript compilation during rollup bundling (tsc-alias)
resolve-tspaths
Transform path mappings in your compiled Typescript code
@jnleonard3/tsc-alias
Replace alias paths with relative paths after typescript compilation.
Replace alias paths with relative paths after typescript compilation
npm install tsc-alias
Typescript
Module System
Min. Node Version
Node Version
NPM Version
v1.8.16 (2025-05-05)
Updated on May 05, 2025
v1.8.15 (2025-04-10)
Updated on Apr 10, 2025
v1.8.14 (2025-04-08)
Updated on Apr 08, 2025
v1.8.13 (2025-03-29)
Updated on Mar 29, 2025
v1.8.12 (2025-03-29)
Updated on Mar 29, 2025
v1.8.11 (2025-02-25)
Updated on Feb 25, 2025
TypeScript (96.28%)
JavaScript (3.59%)
Shell (0.14%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1,024 Stars
246 Commits
73 Forks
4 Watchers
8 Branches
33 Contributors
Updated on Jul 14, 2025
Latest Version
1.8.16
Package Id
tsc-alias@1.8.16
Unpacked Size
134.06 kB
Size
33.86 kB
File Count
45
NPM Version
8.19.2
Node Version
22.0.0
Published on
May 05, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Replace alias paths with relative paths after typescript compilation. You can add aliases that reference other projects outside your tsconfig.json project by providing a relative path to the baseUrl.
+ Compile time (no runtime dependencies)
First, install tsc-alias as devDependency using npm.
1npm install -g tsc-alias
npm install --save-dev tsc-alias
1"scripts": { 2 "build": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json", 3}
or
1"scripts": { 2 "build": "tsc && tsc-alias", 3 "build:watch": "tsc && (concurrently \"tsc -w\" \"tsc-alias -w\")" 4}
If you have an issue, please create one. But, before:
--debug
and check if config is correctly loaded and all sourcefiles are found.1npm install tsc-alias
1import { replaceTscAliasPaths } from 'tsc-alias'; 2 3replaceTscAliasPaths(options?);
Here are all the available options:
Option | Description | Default Value |
---|---|---|
project, p | path to tsconfig.json | 'tsconfig.json' |
watch | Observe file changes | false |
outDir | Run in a folder leaving the "outDir" of the tsconfig.json (relative path to tsconfig) | tsconfig.compilerOptions.outDir |
declarationDir | Works the same as outDir but for declarationDir | tsconfig.compilerOptions.declarationDir |
resolveFullPaths | Attempt to replace incomplete import paths (those not ending in .js ) with fully resolved paths (for ECMAScript Modules compatibility) | false |
resolveFullExtension | Allows you to specify the extension of incomplete import paths, works with resolveFullPaths | '.js' | '.mjs' | '.cjs' |
silent | Reduced terminal output. This is a deprecated option and no longer has any effect. | true |
verbose | Additional information is output to the terminal | false |
debug | Debug information is send to the terminal | false |
replacers | Files to import as extra replacers More info | [] |
output | The output object tsc-alias will send logs to. | new Output(options.verbose) |
fileExtensions | Overwrite file extensions tsc-alias will use to scan and resolve files. | undefined |
tsconfig.json
Example1{ 2 "compilerOptions": { 3 ... 4 }, 5 "tsc-alias": { 6 "verbose": false, 7 "resolveFullPaths": true, 8 "replacers": { 9 "exampleReplacer": { 10 "enabled": true, 11 "file": "./exampleReplacer.js" 12 }, 13 "otherReplacer": { 14 "enabled": true, 15 "file": "./otherReplacer.js" 16 } 17 }, 18 "fileExtensions": { 19 "inputGlob": "{js,jsx,mjs}", 20 "outputCheck": ["js", "json", "jsx", "mjs"] 21 } 22 } 23}
We can use tsc-alias in a single file, with a function that returns the modified contents.
We prepare the replacer with prepareSingleFileReplaceTscAliasPaths()
, passing the same options that we would pass to replaceTscAliasPaths()
. That will return a promise of a function that receives the file contents and path, and returns the transformed contents, synchronously.
1import { prepareSingleFileReplaceTscAliasPaths } from 'tsc-alias'; 2 3const runFile: SingleFileReplacer = await prepareSingleFileReplaceTscAliasPaths(options?); 4 5function treatFile(filePath: string) { 6 const fileContents = fs.readFileSync(filePath, 'utf8'); 7 const newContents = runFile({fileContents, filePath}); 8 // do stuff with newContents 9}
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
1 existing vulnerabilities detected
Details
Reason
Found 11/30 approved changesets -- score normalized to 3
Reason
2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More