0.1.0 • Published 3 years ago
swc-plugin-import-jsx-pragma
Licence
MIT
Version
0.1.0
Deps
0
Size
2.6 MB
Vulns
0
Weekly
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.