Gathering detailed insights and metrics for @zerollup/ts-transform-paths
Gathering detailed insights and metrics for @zerollup/ts-transform-paths
Gathering detailed insights and metrics for @zerollup/ts-transform-paths
Gathering detailed insights and metrics for @zerollup/ts-transform-paths
npm install @zerollup/ts-transform-paths
Typescript
Module System
Node Version
NPM Version
95.6
Supply Chain
100
Quality
75.9
Maintenance
100
Vulnerability
98.9
License
TypeScript (95.24%)
JavaScript (4.29%)
Shell (0.46%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
175 Stars
228 Commits
16 Forks
5 Watchers
1 Branches
7 Contributors
Updated on Jun 16, 2025
Latest Version
1.7.18
Package Id
@zerollup/ts-transform-paths@1.7.18
Size
12.88 kB
NPM Version
lerna/3.20.2/node@v13.6.0+x64 (linux)
Node Version
13.6.0
Published on
Jun 08, 2020
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
1
1
Heavily tested and most complete import/require path rewriter for typescript.
tsconfig baseUrl + paths alias rewriting in bundles and declaration files. You can use absolute paths in libraries. All them will be rewritted to relative in transpiled js and in d.ts files.
Works everywhere, no more tspath, rollup-plugin-alias or webpack resolve alias and other workarounds.
Why? Problem described here: d.ts files not working, if absolute paths used in npm-packaged library.
ts-transform-import-path-rewrite does't support compilerOptions.paths config, doesn't support require function, weak tested.
ts-transformer-imports doesn't support dynamic import and require function. It doesn't support d.ts: "transform": "ts-transformer-imports", "afterDeclarations" true, "before": "true"}
rewrites paths only in d.ts, "transform": "ts-transformer-imports", "afterDeclarations" true, "after": "true"}
rewrites paths only in js.
Since 1.7.4 plugin rewrites paths only in internal project files, not for packages in node_modules.
1// tsconfig.json 2{ 3 "compilerOptions": { 4 "baseUrl": "src" 5 "plugins": [{ "transform": "@zerollup/ts-transform-paths" }], 6 "paths": { "*": ["*"] }, 7 } 8} 9 10// main.ts 11import { app } from "electron"; // a module in node_modules 12import { setMenu } from "main/menu"; // a module in the current dir 13 14// main.js 15const electron_1 = require("electron"); 16const menu_1 = require("./main/menu");
ttypescript is a wrapper around typescript with transformer plugin support in tsconfig.json.
my-lib/tsconfig.json:
1{ 2 "compilerOptions": { 3 "baseUrl": ".", 4 "paths": { 5 "my-lib/*": ["src/*"] 6 }, 7 "plugins": [ 8 { 9 "transform": "@zerollup/ts-transform-paths", 10 "exclude": ["*"] 11 } 12 ] 13 } 14}
my-lib/src/index.ts
1export * from 'my-lib/some'
my-lib/src/some.ts
1export const some = '123'
Transpiled my-lib/dist/index.js
1export * from './some'
Typings my-lib/dist/index.d.ts
1export * from './some';
For more examples see zerollup demo lib.
install:
1$ npm i -D @zerollup/ts-transform-paths ttypescript
add to configure file rollup.config.js
1import ttypescript from 'ttypescript' 2import tsPlugin from 'rollup-plugin-typescript2' 3 4export default { 5 input: 'src/lib.ts', 6 output: [{ file : 'dist/lib.js', name : 'mylib', format : 'iife', sourcemap : true }], 7 plugins: [ 8 tsPlugin({ 9 typescript: ttypescript 10 }) 11 ] 12}
And setup tsconfig.json
1{ 2 "compilerOptions": { 3 "baseUrl": ".", 4 "paths": { 5 "my-lib/*": ["src/*"] 6 }, 7 "plugins": [ 8 { 9 "transform": "@zerollup/ts-transform-paths", 10 "exclude": ["*"] 11 } 12 ] 13 } 14}
1const tsTransformPaths = require('@zerollup/ts-transform-paths'); 2 3module.exports = { 4 module: { 5 rules: [ 6 { 7 test: /\.(ts|tsx)$/, 8 loader: 'ts-loader', 9 options: { 10 getCustomTransformers: (program) => { 11 const transformer = tsTransformPaths(program); 12 13 return { 14 before: [transformer.before], // for updating paths in generated code 15 afterDeclarations: [transformer.afterDeclarations] // for updating paths in declaration files 16 }; 17 } 18 } 19 } 20 ] 21 } 22};
1interface Config { 2 /** 3 Disable plugin path resolving for given paths keys 4 */ 5 exclude?: string[] | void 6}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 2/28 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
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