The tsconfig-paths-resolver is a powerful tool that allows you to resolve TypeScript module paths at build time using your tsconfig.json file. This is particularly useful when you have complex module structures or when you want to optimize your build process.
| dependency | weekly downloads |
|---|---|
| @babel/parser | |
| @babel/generator | |
| json-to-js-obj |
-
Easy Configuration: Integrates seamlessly into your existing TypeScript project by utilizing the
tsconfig.jsonfile. -
Relative Path: Programmatically resolve paths into the relative path
./ || ../based onbaseUrl. -
Support Alias: Ability to resolve both
fix>@app/app.tsandroot>@utility/*.tsaliases -
File Type: Resolve only
JavaScriptcodes.
You can install tsconfig-paths-resolver via npm:
npm install --save-dev tsconfig-paths-resolveryarn add tsconfig-paths-resolver --dev"scripts": {
"build": "npx tsc && npx tspr -s dist -ds resolved-file"
}| flag | description | default |
|---|---|---|
| -s | typescript compiled codes directory | dist |
| -ds | destination path for the resolved codes | none |
If you want to use
custom direcotryusing -s flagnpx tspr -s lib
You can
emitresolved files into separte direcotry using -ds flagnpx tspr -s lib -ds resolved-path
remember it -s <here will be typescript compiler output directory>
that means if your compiled codes .js file inside the src directory
then you should use -s src
If you have any questions, feedback, or need assistance with this package, feel free to reach out:
- Author: Safin Ali
- Email: safin.ali.7205@gmail.com
- GitHub: github.com/Safin-Ali
- Website: https://safin-ali.vercel.app
😊😁 Please review it and let me know if you have any specific concerns or if you'd like further changes.