# swc-plugin-import-jsx-pragma

> SWC plugin for automatically injecting an import statement for JSX pragma.

Latest version **0.1.0** (published 2023-03-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install swc-plugin-import-jsx-pragma
pnpm add swc-plugin-import-jsx-pragma
yarn add swc-plugin-import-jsx-pragma
bun add swc-plugin-import-jsx-pragma
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2023-03-29 |
| First published | 2023-03-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.6 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Kai Hao |
| Maintainers | kevin940726 |
| Keywords | swc-plugin, jsx |

## Links

- npm: https://www.npmjs.com/package/swc-plugin-import-jsx-pragma
- npm.io page: https://npm.io/package/swc-plugin-import-jsx-pragma

## 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.0 (latest) — 2023-03-29

## README

# `swc-plugin-import-jsx-pragma`

[SWC](https://swc.rs/) plugin for automatically injecting an import statement for JSX pragma in classic runtime.

## Installation

```sh
npm i -D swc-plugin-import-jsx-pragma
```

## Usage

See [`jsc.experimental.plugins`](https://swc.rs/docs/configuration/compilation#jscexperimentalplugins):

```json5
// .swcrc
{
  "jsc": {
    "transform": {
      "react": {
        // Currently, these are the required configs.
        "runtime": "classic",
        "pragma": "createElement",
        "pragmaFrag": "Fragment",
      },
    },
    "experimental": {
      "plugins": [
        ["swc-plugin-import-jsx-pragma", {}]
      ]
    }
  }
}
```

It will take this input:
```js
export default function App() {
  return <h1>Hello World</h1>
}
```

And generate this output:
```js
import { createElement } from "react";
export default function App() {
    return /*#__PURE__*/ createElement("h1", null, "Hello World");
}

```

## Options

- `importSource`: `string`, defaults to `react`.

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