Skip to content

Commit 183b666

Browse files
authored
fix: Avoid providing import.meta.env.VITE_IS_DEV_SERVER in preview server (#612)
#609 introduced `import.meta.env.VITE_IS_DEV_SERVER`, which should only be present when dev server is running (not in deploys or for preview server). There was a bug in the logic causing `import.meta.env.VITE_IS_DEV_SERVER` to only get added for the preview server instead of the dev server. This in turn broke HMR with the following: ``` No module found for '__rsc_hot_update' in module lookup for "use server" directive ```
1 parent a341ec5 commit 183b666

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sdk/src/vite/devServerConstant.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const devServerConstantPlugin = (): Plugin => {
1212
return {
1313
name: "rwsdk:dev-server-constant",
1414
config(_, { command, isPreview }) {
15-
if (command === "serve" && isPreview) {
15+
if (command === "serve" && !isPreview) {
1616
// context(justinvdm, 21 Jul 2025): Vite forwards this as `import.meta.env.DEV_IS_DEV_SERVER`
1717
process.env.VITE_IS_DEV_SERVER = "1";
1818
}

0 commit comments

Comments
 (0)