From db5679bb789246ebcf74456dc196cd32d96585a3 Mon Sep 17 00:00:00 2001 From: patak Date: Sun, 17 Sep 2023 15:53:43 +0200 Subject: [PATCH] refactor: remove CJS ssr output format (#13944) Co-authored-by: sapphi-red --- config/ssr-options.md | 9 --------- guide/ssr.md | 8 -------- 2 files changed, 17 deletions(-) diff --git a/config/ssr-options.md b/config/ssr-options.md index d8b65f1e..356c4e66 100644 --- a/config/ssr-options.md +++ b/config/ssr-options.md @@ -20,12 +20,3 @@ Prevent listed dependencies from being externalized for SSR. If `true`, no depen - **Default:** `node` Build target for the SSR server. - -## ssr.format - -- **Experimental:** [CJS support to be removed in Vite 5](https://github.com/vitejs/vite/discussions/13816) -- **Deprecated** Only ESM output will be supported in Vite 5. -- **Type:** `'esm' | 'cjs'` -- **Default:** `esm` - -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. diff --git a/guide/ssr.md b/guide/ssr.md index f70b0385..03fb7cf3 100644 --- a/guide/ssr.md +++ b/guide/ssr.md @@ -266,11 +266,3 @@ The CLI commands `$ vite dev` and `$ vite preview` can also be used for SSR apps :::tip Note Use a post hook so that your SSR middleware runs _after_ Vite's middlewares. ::: - -## SSR Format - -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). - -:::warning Warning -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). -:::