@react-pug/swc-plugin-react-pug
v0.1.18
Published
Programmatic SWC helper for transforming `pug\`...\`` tagged template literals before passing code to SWC.
Downloads
815
Readme
@react-pug/swc-plugin-react-pug
Programmatic SWC helper for transforming pug\...`` tagged template literals before passing code to SWC.
Install
npm i -D @react-pug/swc-plugin-react-pug @swc/coreUsage
import { transformWithSwcReactPug } from '@react-pug/swc-plugin-react-pug'
const result = transformWithSwcReactPug(sourceCode, fileName, {
jsc: {
parser: { syntax: 'typescript', tsx: true },
transform: { react: { runtime: 'automatic' } }
},
sourceMaps: true
})Options
tagFunction: tagged template function name, defaultpugmode:runtime | languageService, defaultruntimerequirePugImport: boolean, defaultfalseclassShorthandProperty:auto | className | class | styleNameclassShorthandMerge:auto | concatenate | classnamesstartupjsCssxjs:never | auto | forcecomponentPathFromUppercaseClassShorthand: boolean, defaulttrue
Used pug import bindings are removed from transformed output automatically.
Exports
transformWithSwcReactPug(...)transformReactPugSourceForSwc(...)- diagnostic/range remapping helpers
Published output is in dist/.
