Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yakovlev-alexey/parcel-resolver-ts-base-url
Resolve tsconfig baseUrl and paths imports with Parcel
https://github.com/yakovlev-alexey/parcel-resolver-ts-base-url
aliases base-url baseurl parcel parcel-resolver paths resolver tsconfig
Last synced: about 5 hours ago
JSON representation
Resolve tsconfig baseUrl and paths imports with Parcel
- Host: GitHub
- URL: https://github.com/yakovlev-alexey/parcel-resolver-ts-base-url
- Owner: yakovlev-alexey
- License: mit
- Created: 2021-12-31T10:41:50.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-15T07:48:15.000Z (almost 2 years ago)
- Last Synced: 2024-10-13T11:36:29.972Z (25 days ago)
- Topics: aliases, base-url, baseurl, parcel, parcel-resolver, paths, resolver, tsconfig
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/parcel-resolver-ts-base-url
- Size: 143 KB
- Stars: 14
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# parcel-resolver-ts-base-url
At the moment Parcel does not support resolving imports using `paths` and `baseUrl` properties from `tsconfig.json`. This is a big issue both when migrating existing projects leveraging these properties and for developers having preference for TypeScript path aliases. This resolver allows you to use the same imports with `parcel@^2` as when using `tsc`.
![](https://img.shields.io/bundlephobia/minzip/parcel-resolver-ts-base-url?style=social)
## Table of Contents
- [parcel-resolver-ts-base-url](#parcel-resolver-ts-base-url)
- [Table of Contents](#table-of-contents)
- [Installation](#installation)
- [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)## Installation
You can install `parcel-resolver-ts-base-url` using npm or yarn:
```bash
npm i --save-dev parcel-resolver-ts-base-url
# or
yarn add -D parcel-resolver-ts-base-url
```## Usage
Simply add `parcel-resolver-ts-base-url` to your `.parcelrc`:
```json
{
"extends": "@parcel/config-default",
"resolvers": ["parcel-resolver-ts-base-url", "..."]
}
```> At the moment `parcel` doesn't provide a way to specify `tsconfig.json` location I know of. `parcel-resolver-ts-base-url` will look for `tsconfig.json` recursively from the import location to the project root (`.parcelrc` location) like Parcel itself does.
Read more about `parcel` configuration in [official docs](https://parceljs.org/features/plugins/).
### Known Issues
- ~~HMR support is unknown.~~ Manually tested and seems to be working. Make sure to submit a [GitHub issue](https://github.com/yakovlev-alexey/parcel-resolver-ts-base-url/issues) if it does not work for you.
- ~~Resources imports using `baseUrl` or `paths` is unsupported in this resolver. Feel free to submit a PR.~~ Has been implemented with tests in place.## Contributing
Feel free to send any suggestions in [GitHub issues](https://github.com/yakovlev-alexey/parcel-resolver-ts-base-url/issues): comment or vote on an existing issue, open a new one or create a Pull Request with your feature. Please make sure to add relevant test cases.
## License
[MIT](/LICENSE)