I am trying to add SVG support to a Preact project. Here is my minimal rollup config:
{
plugins: [
alias({
resolve: extensions,
entries: {
react: path.resolve("./node_modules/preact/compat/src/index.js")
}
}),
svgr({ babel: false }),
resolve({
extensions
}),
babel({
extensions,
babelrc: false,
presets: ["@babel/env", ["@babel/typescript", { jsxPragma: "h" }]],
plugins: [
[
"@babel/plugin-transform-react-jsx",
{
pragma: "h",
pragmaFrag: "Fragment"
}
]
]
})
]
}
Everything works good, except the h function which is added by this plugin is literally outputted as h in the bundle file. but the other h functions are converted to h$1, then I got this Uncaught ReferenceError: h is not defined error only for SVGs.
Could anyone give me a clue to solve this issue? Thanks!
Hello @P233, Preact support is not a goal for now. If the Preact community want to help and make it possible, then its welcome. Until that I am sorry but I will not give support about Preact.