@rnx-kit/esbuild-plugin-import-path-remapper
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

@rnx-kit/esbuild-plugin-import-path-remapper

Build npm version

@rnx-kit/esbuild-plugin-import-path-remapper remaps **/lib/** imports to **/src/**. This is useful for packages that are not correctly exporting everything via their index.ts, but you still want to consume the TypeScript files rather than the transpiled JavaScript.

Usage

Add @rnx-kit/esbuild-plugin-import-path-remapper to your build script plugins. The package name filter argument to the plugin is an esbuild compatible regular expression to match the packages to transform.

For example, to remap all paths under the @rnx-kit scope:

// esbuild.js
const ImportPathRemapperPlugin = require("@rnx-kit/esbuild-plugin-import-path-remapper");

require("esbuild")
  .build({
    entryPoints: ["app.tsx"],
    bundle: true,
    outfile: "out.js",
    plugins: [ImportPathRemapperPlugin("@rnx-kit")],
  })
  .catch(() => process.exit(1));

Readme

Keywords

none

Package Sidebar

Install

npm i @rnx-kit/esbuild-plugin-import-path-remapper

Weekly Downloads

7

Version

3.0.0

License

MIT

Unpacked Size

5.35 kB

Total Files

4

Last publish

Collaborators

  • kelset
  • hansenyy
  • jasonvmorse
  • acoates
  • rnbot
  • tido64
  • rnsdkbot