JSPM

metro-tsconfig-paths

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 586
  • Score
    100M100P100Q103279F
  • License MIT

Use tsconfig 'paths' with Metro

Package Exports

  • metro-tsconfig-paths

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (metro-tsconfig-paths) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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:

const withTSConfig = require('metro-tsconfig-paths')

module.exports = withTSConfig({
  /* Metro configuration goes here */
})

How it works

It uses get-dev-paths to find any locally developed packages. Then it uses tsconfig-paths 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.