Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aleclarson/metro-tsconfig-paths
Use tsconfig 'paths' with Metro
https://github.com/aleclarson/metro-tsconfig-paths
metro tsconfig-paths typescript
Last synced: about 2 months ago
JSON representation
Use tsconfig 'paths' with Metro
- Host: GitHub
- URL: https://github.com/aleclarson/metro-tsconfig-paths
- Owner: aleclarson
- Created: 2019-06-13T17:38:49.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-06-13T21:11:26.000Z (over 5 years ago)
- Last Synced: 2024-10-13T04:05:54.660Z (3 months ago)
- Topics: metro, tsconfig-paths, typescript
- Language: TypeScript
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# metro-tsconfig-paths
Load `tsconfig.json` modules from locally developed packages, and help Metro
resolve imports using their `paths` objects.## Usage
Add the following to your `metro.config.js` module:
```js
const withTSConfig = require('metro-tsconfig-paths')module.exports = withTSConfig({
/* Metro configuration goes here */
})
```## How it works
It uses [`get-dev-paths`][1] to find any locally developed packages. Then it uses
[`tsconfig-paths`][2] to load `tsconfig.json` modules and convert their `paths`
objects into "matcher functions". Then it hooks into your Metro config and applies
the relevant matcher function (if any) to whichever dependency is being resolved.[1]: https://github.com/aleclarson/get-dev-paths
[2]: https://github.com/dividab/tsconfig-paths