News for hackers. Stuff that matters.
Re:Next.js 9.4 – Fast Refresh, Incremental Static Regeneration by moneywoes on Monday May 11, 2020 @12:21PM (#23143790)
For a simple static site, is this a better option than Gatsby?
Re:Next.js 9.4 – Fast Refresh, Incremental Static Regeneration by Hurtak on Monday May 11, 2020 @12:24PM (#23143820)
Definitely, compared to Gatsby, Next is much simpler. At least every time I tried Gatsby, I just had to give up after a few hours because of the complexity and massive amount of boiler plate that you had to stitch up yourself from examples.
Re:Next.js 9.4 – Fast Refresh, Incremental Static Regeneration by gherkinnn on Monday May 11, 2020 @12:32PM (#23143936)
I can only second this. Next just works with minimal (or in fact no) config. And their documentation is great.

Bonus: Next's built-in API support makes building quick APIs for your project (and its static/hybrid/dynamic) data loading a breeze. While not suited for everything, at the very least, Next and Airtable can get your POC/MVC/prototype running in a day.

The few times I tried to build something in Gatsby I was bogged down in mediocre documentation and a mountain of (maybe?) necessary plugins. I don't know.

Not sure how to feel about Gatsby's GraphQL-first approach either.

Re:Next.js 9.4 – Fast Refresh, Incremental Static Regeneration by m_ke on Monday May 11, 2020 @12:39PM (#23144024)
I made a gatsby site about 2 years ago and it has been a nightmare to maintain, the build breaks for random reasons every time I come back to it.

Forcing everything to go through graphql is also a pain and adds an unnecessary indirection that requires a million extra dependencies.

Re:Next.js 9.4 – Fast Refresh, Incremental Static Regeneration by tomduncalf on Monday May 11, 2020 @02:16PM (#23145215)
Interesting, just yesterday I migrated a site from react-static to Gatsby (because of a nasty bug that’s been open in react-static for ages, seems to be struggling somewhat for maintenance) because I thought Gatsby looked simpler than next.js, haha.

Perhaps it was just that Gatsby felt closer to react-static’s model and it was more readily apparent how to adapt a react-static site to Gatsby with as few changes as possible, using their createPage api to replace the route config in react-static and bypassing all the GraphQL as described in https://www.gatsbyjs.org/docs/using-gatsby-without-graphql/ - I didn’t have time to do a detailed comparison of frameworks or rebuild large parts of the site.

I was pleasantly surprised how quick and easy the migration was, took me about 90 mins for a site with about six templates and Gatsby seems to build faster and has a much better ecosystem of plugins etc. I wrote up the process at a high level at https://github.com/react-static/react-static/issues/1203#iss... if anyone is interested in the specifics

Did I understand correctly that next.js isn’t just a static site generator and ideally you have a server side component too? This was what started confusing me in their docs, but perhaps I got the wrong end of the stick.

I’ll have to give next.js a proper look next time I’m building a site from scratch anyway!

Re:Next.js 9.4 – Fast Refresh, Incremental Static Regeneration by tomduncalf on Thursday May 14, 2020 @02:41PM (#23183589)
OK, ended up migrating another site I manage to next.js as the preview feature is a killer for the site admin, and I have to say I do like it more. It's a bit more work to migrate but I think worth it. Thanks for the recommendation!
Re:Next.js 9.4 – Fast Refresh, Incremental Static Regeneration by nobody0 on Tuesday May 12, 2020 @01:12AM (#23150770)
Yeah, not everyone needs to play with GraphQL.
Re:Next.js 9.4 – Fast Refresh, Incremental Static Regeneration by gherkinnn on Monday May 11, 2020 @12:44PM (#23144113)
If you want simple, you can give Charge a try: https://charge.js.org

It's a dead-simple MD -> HTML generator that uses React for templating. No JS code on the client, unless you import your own scripts.

Re:Next.js 9.4 – Fast Refresh, Incremental Static Regeneration by zeusly on Monday May 11, 2020 @03:49PM (#23146194)
Oh this is neat, thanks.
Re:Next.js 9.4 – Fast Refresh, Incremental Static Regeneration by neslinesli93 on Monday May 11, 2020 @01:21PM (#23144547)
In my (quite small) experience, developing with NextJS has been a breeze.

Some time ago I've decided to rewrite a landing page, written in Node + EJS templates + JQuery, using some kind of static generator. I have always heard good things about NextJS as well as Gatsby, but after some exploration I decided to go with NextJS, since Gatsby seemed more complex and better suited for CMS/other complex websites rather than a simple, light landing page.

The developer experience has been amazing. Plus, I've found an awesome library[0] for dealing with i18n, which completely absorbed the pain of dealing with multiple languages: getting SEO right, make links work, and so on.

Plus, pairing NextJS with PReact, brought my pages first-load size down to ~40KB (external resources excluded), which I didn't think it was possible for something built with React.

The only things that I missed from CRA-like apps were environment variables, which have been added with this release, and a good integration with third-party tools like eslint, typescript and prettier. I did not use typescript because it was just overkill for a simple landing, and I'm launching eslint by hand and in the CI, so I really miss how good the integration is when developing a normal React App bootstrapped with CRA (which has all of this awesomeness out of the box).

[0] https://github.com/vinissimus/next-translate

Re:Next.js 9.4 – Fast Refresh, Incremental Static Regeneration by 4lejandrito on Monday May 11, 2020 @02:19PM (#23145255)
I started building my partner's portfolio with Next and was very pleased with its simplicity.

However I had to switch to Gatsby because of its superior support for responsive images.

With Next I couldn't find a way to cache all the generated variants of images between builds, which made the site take more than 5 minutes to build.

Gatsby ecosystem seems more mature also.

Re:Next.js 9.4 – Fast Refresh, Incremental Static Regeneration by searchableguy on Monday May 11, 2020 @01:16PM (#23144487)
Also check out - https://www.11ty.dev/

Imo, simpler if you don't require dynamic views.

Re:Next.js 9.4 – Fast Refresh, Incremental Static Regeneration by rb808 on Monday May 11, 2020 @02:16PM (#23145221)
I tried and gave up after an hour or two. If you're a js developer it might be easy, for regular developers I didn't find it simple at all. Would be great if someone had instructions on how to create a simple blog with a nice template.
Re:Next.js 9.4 – Fast Refresh, Incremental Static Regeneration by greatwhitenorth on Monday May 11, 2020 @02:38PM (#23145458)
I'm a React developer and I still found Gatsby to be a massive pain. I looked it at for a day and just moved away to next.js.
Re:Next.js 9.4 – Fast Refresh, Incremental Static Regeneration by greatwhitenorth on Monday May 11, 2020 @02:34PM (#23145421)
Gatsby is a massive pain compared to next.js. I couldn't understand how to do the simplest things in Gatsby. I went from reading next.js docs to deploying my personal blog in 2 days.
Re:Next.js 9.4 – Fast Refresh, Incremental Static Regeneration by deltron3030 on Monday May 11, 2020 @01:19PM (#23144524)
Both are overkill for that imo. If you don't do fancy stuff and don't want to be outdated in a year, better use something like Jekyll.
Re:Next.js 9.4 – Fast Refresh, Incremental Static Regeneration by rglover on Monday May 11, 2020 @12:51PM (#23144207)
Yes.