File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
packages/e2e-tests/vite-ssr-esm Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,18 @@ export default defineConfig(({ command, mode }) => {
14
14
}
15
15
}
16
16
} ,
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
19
29
ssr : {
20
30
noExternal : [ 'esm-env' ]
21
31
} ,
You can’t perform that action at this time.
0 commit comments