Skip to content

Commit 47bccb6

Browse files
committed
chore: update comment
1 parent 4fb1e5a commit 47bccb6

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/e2e-tests/vite-ssr-esm/vite.config.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,18 @@ export default defineConfig(({ command, mode }) => {
1414
}
1515
}
1616
},
17-
// TODO: investigate the condition issue. it's the same thing dominik and ben found.
18-
// idk why it's only happening after https://github.com/vitejs/vite/pull/18395
17+
// Because `esm-env` is used by Svelte to determine running in dev mode, and that package
18+
// uses `development` condition to determine so in dev. And on the other hand, Vite uses
19+
// `process.env.NODE_ENV` to determine dev mode, which v-p-s passes to `compilerOptions.dev`,
20+
// there's a potential mismatch of dev condition that Svelte doesn't expect, causing a runtime
21+
// error at https://github.com/sveltejs/svelte/blob/53af138d588f77bb8f4f10f9ad15fd4f798b50ef/packages/svelte/src/internal/server/dev.js#L70
22+
// TODO: Figure out if either:
23+
// 1. Svelte should work resiliently with mismatch dev/prod modes.
24+
// 2. We hardcode `ssr.noExternal: ['esm-env']` in v-p-s directly, however we're not resolving the root cause.
25+
// 3. We crawl recursively for `esm-env` to resolve no2, but still kinda hacky.
26+
// 4. Encourage users to set `NODE_OPTIONS="--conditions development"` when running vite dev.
27+
// 5. Vite should revert it's external resolve logic, however we're also not resolving the root cause.
28+
// ... or something else
1929
ssr: {
2030
noExternal: ['esm-env']
2131
},

0 commit comments

Comments
 (0)