-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
isSsrBuild on Vite is false for server build #12585
Comments
See also #9544. This might arguably be a duplicate of that. |
@Conduitry Thanks for linking the issue, couldn't find it while searching. It seems like a workaround for now could be to do an inline Vite plugin that looks like below (based on your code). It will then allow you to apply selective configuration (for example for manualChunks) only for the client build: import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";
export default defineConfig(() => {
const config = {
plugins: [
sveltekit(),
{
name: 'ssr-config',
config(config) {
if (!config?.build?.ssr) {
config.build.rollupOptions = config.build.rollupOptions || {};
config.build.rollupOptions.output = {
...config.build.rollupOptions.output,
manualChunks: (id) => {
return "my-app";
}
}
}
return config;
},
},
],
};
return config;
}); |
Closing as a duplicate of #9544. It's essentially the same gotcha that needs to be documented. |
Describe the bug
isSsrBuild
is incorrectly false for the server build and client build. This prevents us from applying certain Vite configuration only to server/client builds, blocking for example #12581Reproduction
https://github.com/khromov/isSsrBuild-bug-repro
Run
npm run build
, the output is:Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
No response
The text was updated successfully, but these errors were encountered: