-
Notifications
You must be signed in to change notification settings - Fork 922
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
Add experimental SSR support for the dev server #1086
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/pikapkg/snowpack/csvqn0n6v |
@Rich-Harris This file is honestly the best take on importing ESM from the dev server directly into Node.js that I've seen or can think of, at least until those ESM loader hooks are finalized: https://github.com/Rich-Harris/snowpack-svelte-ssr/blob/master/tasks/SnowpackLoader.js It would be out of scope of all users of SSR to implement this themselves. How do you feel about us pulling this into Snowpack directly or shipping this as a separate utility helper package to help people integrate SSR with Snowpack? |
I was secretly hoping you'd suggest something like that! The main reason I didn't bring it up yet was that the result of this approach isn't totally spec compliant (cycles, live bindings) and figured you might prefer something more robust if it's to be part of Snowpack. (Also, I realised that it caches too aggressively - modules aren't invalidated when their dependencies change. Need to fix that.) But more broadly, yeah, I think it would be super useful to have this functionality as part of the API |
@@ -6,6 +6,7 @@ import {getExt, readFile, replaceExt} from '../util'; | |||
|
|||
export interface BuildFileOptions { | |||
isDev: boolean; | |||
isSSR: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
babbd89
to
d348154
Compare
Based off of work done in an internal project with @lukeed and in https://github.com/Rich-Harris/snowpack-svelte-ssr with @Rich-Harris
Changes
import {unstable__startServer} from 'snowpack'
)Testing