{"record":{"id":"2b0b80002e74bc86","repo":"parcel-bundler/parcel","slug":"unsupported-svgr-option-template","errorCode":null,"errorMessage":"Unsupported SVGR option \"template\".","messagePattern":"Unsupported SVGR option \"template\"\\.","errorType":"exception","errorClass":"ThrowableDiagnostic","httpStatus":null,"severity":"error","filePath":"packages/transformers/svg-jsx/src/SvgJsxTransformer.js","lineNumber":62,"sourceCode":"      );\n    }\n\n    let svgr = svgrResult?.contents;\n    if (svgoResult && svgr?.jsx) {\n      throw new ThrowableDiagnostic({\n        diagnostic: await createDiagnostic(\n          md`\nUnsupported SVGR option \"jsx\".\n          `,\n          svgrResult.filePath,\n          '/jsx',\n          options,\n        ),\n      });\n    }\n\n    if (svgr?.template) {\n      throw new ThrowableDiagnostic({\n        diagnostic: await createDiagnostic(\n          md`\nUnsupported SVGR option \"template\".\n          `,\n          svgrResult.filePath,\n          '/template',\n          options,\n        ),\n      });\n    }\n\n    // Prefix ids by default so they don't conflict between svgs.\n    if (svgoConfig && svgoConfig.prefixIds == null) {\n      let hash = hashString(\n        relativePath(options.projectRoot, config.searchPath),\n      );\n      svgoConfig.prefixIds = {\n        prefix: hash.slice(-6),","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/transformers/svg-jsx/src/SvgJsxTransformer.js#L44-L80","documentation":"Thrown by @parcel/transformer-svg-jsx when the SVGR config defines a `template` function. The new rust-based svgReact does not support custom SVGR templates (the function used by legacy SVGR to wrap the generated component). Like the jsx option, this is a deliberate incompatibility surfaced as a ThrowableDiagnostic with the `/template` JSON path and the same fallback hint.","triggerScenarios":"loadConfig reads an SVGR config and `svgr.template` is truthy. Common when porting an SVGR config that customized component output (e.g. to add propTypes, displayName, or a custom wrapper).","commonSituations":"Existing SVGR config from a webpack/CRA project that defines a template; team template that injects defaultProps or width/height props; tutorial copy-paste that includes a template helper.","solutions":["Remove the `template` key from your SVGR config and accept the default output of svgReact.","If the template does something load-bearing (custom props, displayName), either post-process the generated JSX with a SWC/Babel plugin, or switch to the legacy @parcel/transformer-svg-react via .parcelrc as the hint suggests."],"exampleFix":"// before: svgr.config.js\nmodule.exports = {\n  template: (variables, { tpl }) => tpl`${variables.componentName} = props => ...`,\n};\n// after (option a): drop the template\nmodule.exports = {};\n// after (option b): use legacy transformer in .parcelrc\n\"@parcel/transformer-svg-react\"","handlingStrategy":"validation","validationCode":"function assertNoSVGRTemplate(config) {\n  if (config?.template) {\n    throw new Error('.svgrrc: template is not supported by @parcel/transformer-svg-jsx; remove it or switch to @parcel/transformer-svg-react');\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Move custom component-wrapping logic out of SVGR templates into a SWC/Babel plugin or a wrapper component.","Keep .svgrrc minimal (icon, dimensions, etc.) when using the rust transformer."],"tags":["svg","svgr","config","transformer","migration"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}