-
-
Notifications
You must be signed in to change notification settings - Fork 646
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
Support Isomorphic Apps? #1092
Comments
Hi, as a first step, I will replace reference to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis |
Hi @L1lith any chance for your to test the last version ? latest 10.7.0 version using globalThis instead of window has been updated here : thanks! |
Hi @L1lith , so many changes as you can see over the weekend, but now melonJS does not crash anymore when executed in node.js 🎉 🎉 🎉 I haven't tried it but even though it's being "loaded" it will still require at least jsdom and node-canvas to work properly. In case you are testing this further, feel free to share any more return of experience with using those two together with melonJS Thanks again ! |
Hi, with the latest 10.7.0 release, that now allows to run melonJS in node.js without crashing, I will close this ticket. For further information, and maybe more return of experience mixing melonJS & node.js, I invite you to continue the discussion on the topic I created in our new forum : thanks again @L1lith for the feedback and suggestion ! |
When you import melonjs in Node it immediately throws an error because it can't access the window before you even call anything at all. I was thinking it would be cool if it wouldn't access the window unless the libraries actually started rendering because when I try to deploy my isomorphic app it can't run my app inside the Node.js server.
I understand this isn't a big issue for Melon.js overall but I do think it would be cool to have better integration with JS frameworks with Isomorphic rendering like Solid.js and React (with Next.js etc)
I also think this goes along with this issue, and is a good design pattern in my opinion because things probably shouldn't run in a global context, but rather when their respective functions are called. That's my 2 cents anyways, feel free to take this suggestion with a grain of salt.
I haven't deployed MelonJS to an isormophic application yet, but I was trying to do some testing of my app inside Node.js and importing MelonJS was causing the app to break during testing which was a little frustrating.
The text was updated successfully, but these errors were encountered: