-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Make SSR environment-agnostic (don't count on 'global') #3561
Comments
Changing it to export In any case, I do think that shimming |
Of cource, NodeJS is most popular, but environment-agnostic is a good thing. Vue team, for example, take care of it since version 2.5 What do you mean about access to an object of all globals? This is NodeJS only feature, not v8: |
Consider the following component, compiled for SSR: <script>
let Object;
</script>
<Foo {...foo}></Foo> Svelte uses Shimming |
Ok, I see. |
I think that would work, although we'd still need to fall back to |
Yes. And may be check for |
Hello! I came across this issue in #4545. (Please take a look at it if you get a chance... I don't understand why If we implemented a technique like @warmrobot, we'd be able to support using Svelte stores in WebWorkers which allow for reactive programming (via store subscriptions) in that environment. |
Released in 3.21.0 - we now try |
Is your feature request related to a problem? Please describe.
We do not use Node, we use v8 instance. So, when I compile simple test page in SSR mode, I get 'Uncaught ReferenceError: global is not defined'.
Describe the solution you'd like
Add
typeof global
check heresvelte/src/runtime/internal/globals.ts
Line 3 in 64c805b
If
global
is undefined then return {}How important is this feature to you?
No chances, that we start using Node because of this. (
So, I had to add global mock (somehow), but better solution is to change the line, that I mentioned
Additional context
The text was updated successfully, but these errors were encountered: