slinky
slinky copied to clipboard
Add support for Next.JS
Add the ability to optionally use the Next.JS framework to build your React apps. I think if Slinky integrated the Next.JS framework and added the ability to pump out a Next app, Slinky is going to be truly the most scalable web framework in the world.
💯. But I'd suspect that might have to wait for after #461?
I'll just mention my own WIP example of Slinky with Next.js, there certainly are pitfalls that will make your whole app break, but it is quite possible to write a Next.js app with Slinky.
Currently, some of the struggles that remain are how to make properly split code, since Scala.js module splitting sees function components as static initializers, they are all bundled together into the same file, thus making large apps quite ineffective at code-splitting.
Also, you'll have to use def
every time you use something that only should run on the server, otherwise, it is bundled with the frontend bundle.
If time and motivation allow, I hope to be able to create a more comprehensive example/integration of Next.js into the Slinky/Scala.js ecosystem.
Repo can be found here: https://github.com/Asamsig/next-slinky-example
I've started prototyping what Next.js integrations with Slinky could look like in #588. I'm seeing the same bundle splitting issue as @Asamsig, so trying to debug that since you end up losing a lot of the benefits when everything is in one bundle.
Tracking issue in Scala.js that prevents us from eliminating glue code: https://github.com/scala-js/scala-js/issues/4742
We now have basic Next.js support, so moving this to backlog while we're blocked on upstream.