slinky icon indicating copy to clipboard operation
slinky copied to clipboard

Add support for Next.JS

Open doug-sheridan opened this issue 3 years ago • 5 comments

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.

doug-sheridan avatar Dec 15 '20 16:12 doug-sheridan

💯. But I'd suspect that might have to wait for after #461?

no-identd avatar Aug 07 '21 13:08 no-identd

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

Asamsig avatar Sep 13 '21 16:09 Asamsig

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.

shadaj avatar Aug 24 '22 03:08 shadaj

Tracking issue in Scala.js that prevents us from eliminating glue code: https://github.com/scala-js/scala-js/issues/4742

shadaj avatar Oct 17 '22 05:10 shadaj

We now have basic Next.js support, so moving this to backlog while we're blocked on upstream.

shadaj avatar Dec 21 '22 00:12 shadaj