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
tsconfig-paths
Load node modules according to tsconfig paths, in run-time or via API.
babel-plugin-module-resolver
Module resolver plugin for Babel
tsconfig-paths-webpack-plugin
Load modules according to tsconfig paths in webpack.
eslint-import-resolver-node
Node default behavior import resolution plugin for eslint-plugin-import.
npm install babel-plugin-tsconfig-paths-module-resolver
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
40 Stars
58 Commits
2 Forks
2 Watching
7 Branches
2 Contributors
Updated on 01 Nov 2024
Minified
Minified + Gzipped
TypeScript (94.89%)
JavaScript (3.42%)
Shell (1.69%)
Cumulative downloads
Total Downloads
Last day
-3.2%
2,833
Compared to previous day
Last week
8.4%
15,659
Compared to previous week
Last month
29%
63,756
Compared to previous month
Last year
84.2%
574,955
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
10 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
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