Skip to content

Commit 30e0301

Browse files
add env handling back
1 parent adfca63 commit 30e0301

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/ssr-plugin.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,13 @@ async function renderComponentToSSR(
254254
): Promise<{ html: string }> {
255255
const viteServer = ctx.project.vite;
256256

257+
// vite doesn't replace import.meta.env with hardcoded values so we need to do it manually
258+
for (const [key, value] of Object.entries(viteServer.config.env)) {
259+
// biome-ignore lint/style/noNonNullAssertion: it's always defined
260+
viteServer.config.define![`__vite_ssr_import_meta__.env.${key}`] =
261+
JSON.stringify(value);
262+
}
263+
257264
const qwikModule = await viteServer.ssrLoadModule("@builder.io/qwik");
258265
const { jsx } = qwikModule;
259266
const jsxElement = jsx(Component, props);

0 commit comments

Comments
 (0)