svelte-jsx
svelte-jsx copied to clipboard
Adjacent JSX elements must be wrapped in an enclosing tag
Hi there. I've been looking for a working svelte testing solution, and so far svelte-jester is broken with ESM. Then I came across this and I set this up with jest and babel with preset-env. However, it gave the following error upon running jest:
Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>? (10:0)
It runs fine with Vite though, so its not a issue with my code. I'm not sure how to disable this specific error.
This is my babel configuration:
{
"presets": [
["@babel/preset-env", { "targets": { "node": "current" } }],
["@babel/preset-typescript"]
],
"plugins": [
"babel-plugin-transform-vite-meta-env",
[
"@babel/plugin-transform-react-jsx",
{ "runtime": "automatic", "importSource": "svelte-jsx" }
]
]
}
What’s the code?
This is likely unrelated to this package, but a difference in how Babel and esbuild handle JSX. In particular, esbuild would probably be wrong, because JSX is a React thing, and the maintainers there treat Babel as the reference implementation.