Replies: 16 comments 47 replies
-
I'm wondering; if all server dependencies are externalized, what exactly is the problem here? Why should I want Vite to transpile the AWS SDK? Wouldn't I want to externailize and let Node.js use it directly instead? For example #1374 (comment) is not really a SSR problem but more a browser-transpiling problem. If anyhting it's a Vite core problem (not transpiling Node-only builtins) but certainly not a Vite SSR problem. Or is it about being able to have fine-grain control over what is treated as "Browser code that should be transpiled" VS "Node.js code that should be externalized"? |
Beta Was this translation helpful? Give feedback.
-
From my perspective, only two things are missing for a perfect Vite native SSR API. 1. Better handling of the server entry —
|
Beta Was this translation helpful? Give feedback.
-
With |
Beta Was this translation helpful? Give feedback.
-
Something that's quite unclear to me from the docs is the part about dependency pre-bundling. The docs make no mention of whether this is for the client-side only or includes the server-side. It seems to me that it might be only the client-side because the behavior is very different between the client and server. It would be nice if the server could simply use the prebundled ESM the same way that the client does because it's frustrating to have the client working and the server broken eventhough they're using the same packages |
Beta Was this translation helpful? Give feedback.
-
pure esm packages currently don't work without ssr.noExternal + optimizeDeps.exclude should be documented and if possible either handled automatically or at least add a helpful error message |
Beta Was this translation helpful? Give feedback.
-
Another thing that perhaps should be resolved before marking SSR as production ready is CSS injection during SSR: #2282 There are workarounds for user-land but I would expect Vite to handle this if it's production ready 🤔 |
Beta Was this translation helpful? Give feedback.
-
Here's a bug that I've done some preliminary investigation into and should be fixed as part of these efforts: https://github.com/vitejs/vite/issues/4113 |
Beta Was this translation helpful? Give feedback.
-
Is there a temporary solution currently to deal with problematic dependencies? |
Beta Was this translation helpful? Give feedback.
-
Is it possible to automatically find out problematic dependencies? |
Beta Was this translation helpful? Give feedback.
-
Another SSR bug: #4452 |
Beta Was this translation helpful? Give feedback.
-
I created a list of the Vite issues that SvelteKit users most often hit: sveltejs/kit#2086 |
Beta Was this translation helpful? Give feedback.
-
Sorry I'm late to the party, hopefully not too late. After skimming through some comments above, I just want to add up some of my opinions on config API improvement for SSR mode from my experiences of making the 1. Enable the HTTP server in SSR mode
2. Allow user to add middlewares to the HTTP server
3. framework adaptersThe request object from vite http server is compatible with connect-like frameworks. However, it may require some extra works to let other frameworks like fastify to handle it. We can either write some documents for it or write some official adapters. In fact, I kinda already doing this in the This approach should resolve the problem 1 from @brillout 's comment #4230 (comment) |
Beta Was this translation helpful? Give feedback.
-
Not sure if this is the same as some of the issues that you've all been having but, in Solid JSX is treated special. We wrote a plugin that transforms It's a bit tedious. Not sure if the solutions here will address that but thought I'd share. I think the fact that the plugin transform only working on the package entry point is really obnoxious but I think that what I'm seeing is more of a combination of multiple issues more than any single one. Luckily Solid doesn't have the .cjs issue so much but I would think that nested imports being handled properly would be an expectation here. Couldn't plugin transform just apply to everything? |
Beta Was this translation helpful? Give feedback.
-
Is it correct that when resolving Edit: This actually seems to be a problem with aliasing subpaths which doesn't work correctly in the way I am using it. |
Beta Was this translation helpful? Give feedback.
-
Most issues with SSR deps seems to be resolved now in vite@2.7.0-beta.10, if you had some problems in your projects with previous versions it would be very helpful to test with this beta and create new issues for them if you still experience a problem |
Beta Was this translation helpful? Give feedback.
-
SSR: Hydration mismatch When following this example for ssr: https://vitejs.dev/guide/ssr.html & https://github.com/vitejs/vite/tree/main/packages/playground/ssr-vue i always get hydration mismatch on dev server using base route http://localhost:3000/ as ist seems it never runs through the app.use('*', //some function) of express which would handle the ssr. on prod build it's working fine. any idea? |
Beta Was this translation helpful? Give feedback.
-
Currently, Vite SSR is marked as experimental. The core team perceives the biggest blocker to be a significant number of dependencies which do not work out of the box, requiring manual configuration of Vite's dependency resolution to get working. While it is inevitable that we cannot cover for every possible dependency and configuration, the majority should "just work" before Vite SSR should be considered non-experimental.
Examples of modules that encounter issues include:
In order to get SSR to general availability, we would like to:
d3
and cyclic dependencies), but this list will focus only on ones that occur during SSR.optimizeDeps
andssr
options better.optimizeDeps.include
,optimizeDeps.exclude
,ssr.noExternal
, andssr.external
tend to be unclear to most people.// cc @axe-me @brillout @dominikg @DylanPiercey @egoist @frandiox @g-plane @kiaking @LinusBorg @marvinhagemeister @meteorlxy @ryansolid @Subwaytime @TomokiMiyauci @wheatjs
TL;DR
Please respond to this discussion if you are either:
Click here to submit problematic dependencies
Click here to view the SSR Dependency Database (added soon)
Beta Was this translation helpful? Give feedback.
All reactions