# babel-plugin-dynamic-import-node

> Babel plugin to transpile import() to a deferred require(), for node

Latest version **2.3.3** (published 2020-04-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-dynamic-import-node
pnpm add babel-plugin-dynamic-import-node
yarn add babel-plugin-dynamic-import-node
bun add babel-plugin-dynamic-import-node
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.3.3 |
| Published | 2020-04-21 |
| First published | 2016-11-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 574 |
| Author | Jordan Gensler |
| Maintainers | airbnbeng, etienne_tripier, jordangens, lencioni, ljharb, milesj, noratarano, schleyfox, sharmilajesupaul |
| Keywords | babel, plugin, dynamic, import, node |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-dynamic-import-node
- Repository: https://github.com/airbnb/babel-plugin-dynamic-import-node
- Homepage: https://github.com/airbnb/babel-plugin-dynamic-import-node#readme
- Issues: https://github.com/airbnb/babel-plugin-dynamic-import-node/issues
- npm.io page: https://npm.io/package/babel-plugin-dynamic-import-node

## Dependencies (1)

- [object.assign](https://npm.io/package/object.assign.md) ^4.1.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

- 2.3.3 (latest) — 2020-04-21
- 2.3.2 — 2020-04-20
- 2.3.1 — 2020-04-20
- 2.3.0 — 2019-06-18
- 2.2.0 — 2018-10-08
- 2.1.0 — 2018-08-29
- 2.0.0 — 2018-06-26
- 1.2.0 — 2017-11-13
- 1.1.0 — 2017-09-11
- 1.0.2 — 2017-05-05
- 1.0.1 — 2017-03-18
- 1.0.0 — 2016-11-11

## README

# babel-plugin-dynamic-import-node

Babel plugin to transpile `import()` to a deferred `require()`, for node. Matches the [proposed spec](https://github.com/domenic/proposal-import-function).

**NOTE:** Babylon >= v6.12.0 is required to correctly parse dynamic imports.

## Installation

```sh
npm install babel-plugin-dynamic-import-node --save-dev
```

## Usage

### Via `.babelrc` (Recommended)

**.babelrc**

```json
{
  "plugins": ["dynamic-import-node"]
}
```

#### Options

- *`noInterop`* - A boolean value, that if true will not interop the require calls. Useful to avoid using `require('module').default` on commonjs modules.

```json
{
  "plugins": [
    ["dynamic-import-node", { "noInterop": true }]
  ]
}
```

### Via CLI

```sh
$ babel --plugins dynamic-import-node script.js
```

### Via Node API

```javascript
require('babel-core').transform('code', {
  plugins: ['dynamic-import-node']
});
```

### Code Example
```javascript
Promise.all([
  import('./lib/import1'),
  import('./lib/import2')
 ]).then(([
   Import1,
   Import2
  ]) => {
   console.log(Import1);
   /* CODE HERE*/
  });
```

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