-
Notifications
You must be signed in to change notification settings - Fork 48
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
Importing the library is causing a crash on SSR - non isomorphic #55
Comments
Hello :) Are there any plans to fix this issue? |
Yes, #61 should fix it (and fix other scenarios like incognito). |
Thank you! |
It turns out that #61 won't fix this. The main problem is that SSR tools like Gatsby currently don't support anything browser related on the server side. It is unreasonable to expect every browser module to polyfill their module for browser globals since browser code should be expected to run... in the browser. I am currently working on a pre-rendering tool which solves this problem, because it is definitely possible to be done on the backend instead of trying to fix every browser module. You may see an example here: https://github.com/jharrilim/rolledup/tree/master/examples/proj The React code in that "proj" example emits the static HTML found in the "dist" folder. |
@jharrilim Can't you do a I'm a bit less sure about the This issue unfortunately makes this library impossible to use with Next.js, since it has SSR by default 😞 |
I remember that the problem came because the Custom Event was not being able to be extended conditionally so it was always failing because of the extend. |
Hey ho! Any luck with this? |
One possible solution here: #17 (comment) |
well... that is to dirty for me, TBH) |
You could use https://github.com/Comandeer/babel-plugin-banner to add |
Sorry for the super late response; yes, I believe so. IIRC, The things that are needed to make this work are:
Unfortunately with regards to the rolledup project, well... it was easy to prove that you could build a node environment pre-renderer that used browser globals, but creating an alternative to Gatsby takes a lot more work 😅 |
This might help: #80 |
Now that #80 is merged, when can we expect a new version to be published? @jharrilim |
@trevorblades 2.4.4 version has the fix for SSR. |
The problem
As this library perform operations on import with CustomEvent api that only works on client importing this on files that are being used from server side is causing a crash.
The text was updated successfully, but these errors were encountered: