Skip to content

Commit

Permalink
fix: only activate jsxRuntime: "classic" for a specific combination
Browse files Browse the repository at this point in the history
  • Loading branch information
magne4000 committed Nov 30, 2023
1 parent 990d670 commit 7d3425b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions boilerplates/react/files/$vite.config.ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@ import { addVitePlugin, loadAsMagicast, type TransformerProps } from "@batijs/co
export default async function getViteConfig(props: TransformerProps) {
const mod = await loadAsMagicast(props);

const options = props.meta.BATI.has("vercel")
const vikeOptions = props.meta.BATI.has("vercel")
? {
prerender: true,
}
: {};
// See https://github.com/batijs/bati/pull/124
const reactOptions = props.meta.BATI.has("vercel") && props.meta.BATI.has("hattip") ? { jsxRuntime: "classic" } : {};

addVitePlugin(mod, {
from: "@vitejs/plugin-react",
constructor: "react",
// see https://github.com/vitejs/vite/discussions/5803#discussioncomment-5562200
options: {},
options: reactOptions,
});
addVitePlugin(mod, {
from: "vike/plugin",
constructor: "ssr",
options,
options: vikeOptions,
});

return mod.generate().code;
Expand Down

0 comments on commit 7d3425b

Please sign in to comment.