# babel-plugin-transform-import-maps

> A plugin to transform ECMAScript module bare/url import specifiers at build-time

Latest version **0.1.1** (published 2022-06-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-transform-import-maps
pnpm add babel-plugin-transform-import-maps
yarn add babel-plugin-transform-import-maps
bun add babel-plugin-transform-import-maps
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2022-06-26 |
| First published | 2022-06-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=14.17 |
| Dependencies | 2 |
| Unpacked size | 20.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Fuwei Chin |
| Maintainers | fuweichin |
| Keywords | babel-plugin, import-maps |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-transform-import-maps
- Repository: https://github.com/fuweichin/babel-plugin-transform-import-maps
- Homepage: https://github.com/fuweichin/babel-plugin-transform-import-maps#readme
- Issues: https://github.com/fuweichin/babel-plugin-transform-import-maps/issues
- npm.io page: https://npm.io/package/babel-plugin-transform-import-maps

## Dependencies (2)

- [import-maps](https://npm.io/package/import-maps.md) ^0.2.4
- [schema-utils](https://npm.io/package/schema-utils.md) ^4.0.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2022-06-26
- 0.1.0 — 2022-06-07

## README

# babel-plugin-transform-import-maps

transform bare / url module specifiers in the [import statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import), [export statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export) and [dynamic import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#dynamic_imports) with importmap. see also [rollup-plugin-import-maps](https://github.com/fuweichin/rollup-plugin-import-maps)

**Contents:**

<!--ts-->
   * [Install](#install)
   * [Usage](#usage)
      * [Basic Usage](#basic-usage)
      * [Plugin Options](#plugin-options)
   * [Related Efforts](#related-efforts)
   * [Maintainers](#maintainers)
   * [License](#license)
<!--te-->



## Install

```sh
npm install --save-dev babel-plugin-transform-import-maps
```



## Usage

### Basic Usage

edit babel.config.json

```json
{
  "presets": [
    ["@babel/preset-env", {
      "modules": false
    }]
  ],
  "plugins": [
    ["babel-plugin-transform-import-maps", {
      "srcPath": "./index.importmap",
      "transformingReport": "-" 
    }]
  ]
}
```



### Plugin Options

+ `srcPath`:string optional

  file path to importmap

+ `srcText`:string optional

  plain text of importmap

+ `srcObject`:Object optional

  parsed object of importmap

  **Note:** One of `srcObject`, `srcText`, `srcPath` should be specified, if multiple of them specified, then precedence order is: srcObject, srcText, srcPath.

+ `baseDir`: string default `process.cwd()`

  baseDir to calculate scope paths in order to match scopes defined in importmap

+ `transformingReport`:string default `undefined`

  set a file path to save transforming report as a Concatenated JSON file, will output to Console if value set to `"-"`

+ `exclude`:string|RegExp|Function default `undefined`

  skip bare/url specifiers from resolving / transforming according to importmap.

  e.g. `/\.(json|wasm|css)$/`, `(source, importer)=> /\.(json|wasm|css)$/.test(source)`, `.css,.wasm,.json`



## Related Efforts

+ [import-maps](#) - Reference implementation playground for import maps proposal



## Maintainers

[@fuweichin](https://github.com/fuweichin)




## License

[MIT](./LICENSE)

Other licenses of dependencies

+ import-maps: [W3C Software and Document License](http://www.w3.org/Consortium/Legal/2015/copyright-software-and-document) and [W3C CLA](https://www.w3.org/community/about/agreements/cla/)

---
_Source: https://npm.io/package/babel-plugin-transform-import-maps · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
