fix(vite): support jsx namespaces (#3539)
Babel throws when encountering jsx namespaces by default. It needs a setting to not throw.
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
export default function Page() {
|
||||||
|
return (
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xml:space="preserve"
|
||||||
|
>
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -375,6 +375,7 @@ function babelTransform(
|
|||||||
runtime: "automatic",
|
runtime: "automatic",
|
||||||
importSource: "preact",
|
importSource: "preact",
|
||||||
development: isDev,
|
development: isDev,
|
||||||
|
throwIfNamespace: false,
|
||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ export function patches(): Plugin {
|
|||||||
runtime: "automatic",
|
runtime: "automatic",
|
||||||
importSource: "preact",
|
importSource: "preact",
|
||||||
development: isDev,
|
development: isDev,
|
||||||
|
throwIfNamespace: false,
|
||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -490,3 +490,14 @@ Deno.test({
|
|||||||
sanitizeOps: false,
|
sanitizeOps: false,
|
||||||
sanitizeResources: false,
|
sanitizeResources: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Deno.test({
|
||||||
|
name: "vite dev - support jsx namespace",
|
||||||
|
fn: async () => {
|
||||||
|
const res = await fetch(`${demoServer.address()}/tests/jsx_namespace`);
|
||||||
|
const text = await res.text();
|
||||||
|
expect(text).toContain(`xml:space="preserve"`);
|
||||||
|
},
|
||||||
|
sanitizeOps: false,
|
||||||
|
sanitizeResources: false,
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user