Skip to content

Commit db5679b

Browse files
refactor: remove CJS ssr output format (#13944)
Co-authored-by: sapphi-red <green@sapphi.red>
1 parent b8ba9e0 commit db5679b

File tree

2 files changed

+0
-17
lines changed

2 files changed

+0
-17
lines changed

config/ssr-options.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,3 @@ Prevent listed dependencies from being externalized for SSR. If `true`, no depen
2020
- **Default:** `node`
2121

2222
Build target for the SSR server.
23-
24-
## ssr.format
25-
26-
- **Experimental:** [CJS support to be removed in Vite 5](https://github.com/vitejs/vite/discussions/13816)
27-
- **Deprecated** Only ESM output will be supported in Vite 5.
28-
- **Type:** `'esm' | 'cjs'`
29-
- **Default:** `esm`
30-
31-
Build format for the SSR server. Since Vite v3 the SSR build generates ESM by default. `'cjs'` can be selected to generate a CJS build, but it isn't recommended. The option is left marked as experimental to give users more time to update to ESM. CJS builds require complex externalization heuristics that aren't present in the ESM format.

guide/ssr.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,3 @@ The CLI commands `$ vite dev` and `$ vite preview` can also be used for SSR apps
266266
:::tip Note
267267
Use a post hook so that your SSR middleware runs _after_ Vite's middlewares.
268268
:::
269-
270-
## SSR Format
271-
272-
By default, Vite generates the SSR bundle in ESM. There is experimental support for configuring `ssr.format`, but it isn't recommended. Future efforts around SSR development will be based on ESM, and CommonJS remains available for backward compatibility. If using ESM for SSR isn't possible in your project, you can set `legacy.buildSsrCjsExternalHeuristics: true` to generate a CJS bundle using the same [externalization heuristics of Vite v2](https://v2.vitejs.dev/guide/ssr.html#ssr-externals).
273-
274-
:::warning Warning
275-
Experimental `legacy.buildSsrCjsExternalHeuristics` and `ssr.format: 'cjs'` are going to be removed in Vite 5. Find more information and give feedback [in this discussion](https://github.com/vitejs/vite/discussions/13816).
276-
:::

0 commit comments

Comments
 (0)