Gathering detailed insights and metrics for babel-plugin-tsconfig-paths-module-resolver
Gathering detailed insights and metrics for babel-plugin-tsconfig-paths-module-resolver
Gathering detailed insights and metrics for babel-plugin-tsconfig-paths-module-resolver
Gathering detailed insights and metrics for babel-plugin-tsconfig-paths-module-resolver
Use tsconfig-paths in any bundler that supports a custom babel config.
npm install babel-plugin-tsconfig-paths-module-resolver
Typescript
Module System
Node Version
NPM Version
TypeScript (94.89%)
JavaScript (3.42%)
Shell (1.69%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
41 Stars
69 Commits
2 Forks
2 Watchers
8 Branches
2 Contributors
Updated on Jul 01, 2025
Latest Version
1.0.4
Package Id
babel-plugin-tsconfig-paths-module-resolver@1.0.4
Unpacked Size
20.73 kB
Size
6.38 kB
File Count
16
NPM Version
7.21.1
Node Version
18.13.0
Published on
Jan 23, 2023
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
2
19
Combines
babel-plugin-module-resolver
andtsconfig-paths
to make a babel plugin that resolves tsconfig paths.Use tsconfig-paths in any bundler that supports a custom babel config.
This library is a re-export of babel-plugin-module-resolver
pre-configured with tsconfig paths support via the package tsconfig-paths
.
It aims to be stable by relying on these already widely-used packages to power the heavy logic:
dependency | weekly downloads |
---|---|
babel-plugin-module-resolver | |
tsconfig-paths |
These dependencies are automatically updated via renovate bot and semantic release.
How is this different from babel-plugin-tsconfig-paths
?
tsconfig-paths
and babel-plugin-module-resolver
) to do the actual logic. The source code for this library is around ~100 SLOC which makes it easy to test and maintain.babel-plugin-module-resolver
— giving you all the features of that babel plugin including custom resolve functions.npm install --save-dev babel-plugin-tsconfig-paths-module-resolver
or
yarn add --dev babel-plugin-tsconfig-paths-module-resolver
Specify the plugin in your .babelrc
(or equivalent configuration file).
1{ 2 "presets": [ 3 // ... 4 "@babel/preset-typescript", 5 // ... 6 ], 7 "plugins": [ 8 // add this to your babel config file in `plugins` 9 // 👇👇👇 10 "tsconfig-paths-module-resolver" 11 // 👆👆👆 12 // ... 13 ] 14}
That's it! Paths from your tsconfig.json should now work!
babel-plugin-tsconfig-paths-module-resolver
accepts the same options as babel-plugin-module-resolver
.
You can supply those extra options in your babel configuration file like so:
1{ 2 "presets": [ 3 // ... 4 "@babel/preset-typescript", 5 // ... 6 ], 7 "plugins": [ 8 // ... 9 [ 10 "tsconfig-paths-module-resolver", 11 // add extra options here 12 // 👇👇👇 13 { 14 // see here: 15 // https://github.com/tleunen/babel-plugin-module-resolver/blob/master/DOCS.md 16 } 17 // 👆👆👆 18 ] 19 ] 20};
resolvePath
and createResolvePath
babel-plugin-module-resolver
includes a configuration option to allow you to programmatically resolve your imports.
This plugin provides a resolvePath
implementation powered by tsconfig-paths
. If you'd like to implement your own resolvePath
implementation while still utilizing this plugin's default implementation, you can separately import createResolvePath
that returns a resolvePath
implementation.
1const createResolvePath = require('babel-plugin-tsconfig-paths-module-resolver/create-resolve-path'); 2const defaultResolvePath = createResolvePath(); 3 4/** 5 * @param sourceFile {string} the input source path 6 * @param currentFile {string} the absolute path of the current file 7 * @param opts {any} the options as passed to the Babel config 8 * @return {string} 9 */ 10function customResolvePath(sourceFile, currentFile, opts) { 11 // ... 12 const result = defaultResolvePath(sourceFile, currentFile, opts); 13 // ... 14 15 return result; 16} 17 18// .babelrc.js 19module.exports = { 20 presets: [ 21 // ... 22 '@babel/preset-typescript', 23 // ... 24 ], 25 plugins: [ 26 // ... 27 [ 28 'tsconfig-paths-module-resolver', 29 { 30 // 👇👇👇 31 resolvePath: customResolvePath, 32 // 👆👆👆 33 }, 34 ], 35 ], 36};
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
5 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 4
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
14 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
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