Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function jsxPlugin(code, config, state) {
const filePath = state.filePath || 'unknown'
const hastTree = parse(code)
const babelTree = hastToBabelAst(hastTree)
const { code: generatedCode } = transformFromAstSync(babelTree, code, {
caller: {
name: 'svgr',
},
presets: [
createConfigItem([svgrBabelPreset, { ...config, state }], {
type: 'preset',
}),
],
filename: filePath,
babelrc: false,
configFile: false,
code: true,
ast: false,
inputSourceMap: false,