0.1.0 • Published 1 year ago
swc-plugin-import-jsx-pragma v0.1.0
swc-plugin-import-jsx-pragma
SWC plugin for automatically injecting an import statement for JSX pragma in classic runtime.
Installation
npm i -D swc-plugin-import-jsx-pragma
Usage
// .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:
export default function App() {
return <h1>Hello World</h1>
}
And generate this output:
import { createElement } from "react";
export default function App() {
return /*#__PURE__*/ createElement("h1", null, "Hello World");
}
Options
importSource
:string
, defaults toreact
.
0.1.0
1 year ago