@svgr/webpack with `jsxRuntime: 'classic-preact'` emits `React` namespace usage
Author: jet2jetCreated Feb 1, 2026Updated Feb 1, 2026
Bug Report
When using jsxRuntime: 'classic-preact' option in @svgr/webpack, emitted module includes React namespace reference which is not defined by default.
To Reproduce
- Use
@svgr/webpack - Configure webpack.config for
.svgfile to use@svgr/webpackwithjsxRuntime: 'classic-preact':
rules: [
{
test: /\.svg$/i,
use: {
loader: '@svgr/webpack',
options: {
jsxRuntime: 'classic-preact',
}
}
}
]- Build files
Expected behavior
svg modules uses preact-related API only
(Actual behavior: svg modules uses React.createElement instead of preact API)
Link to repl or repo (highly encouraged)
https://github.com/jet2jet/svgr-preact-test
Run npx envinfo --system --binaries --npmPackages @svgr/core,@svgr/cli,@svgr/webpack,@svgr/rollup --markdown --clipboard
Paste the results here:
## System:
- OS: Linux 6.6 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
- CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
- Memory: 5.30 GB / 7.58 GB
- Container: Yes
- Shell: 5.1.16 - /bin/bash
## Binaries:
- Node: 20.19.3 - /home/user/.asdf/installs/nodejs/v20.19.3/bin/node
- npm: 11.5.1 - /home/user/.asdf/installs/nodejs/v20.19.3/bin/npm
- pnpm: 8.7.1 - /home/user/.local/share/pnpm/pnpm
## npmPackages:
- @svgr/core: ^8.1.0 => 8.1.0
- @svgr/webpack: ^8.1.0 => 8.1.0 Source: gregberge/svgr