The Experience of Deploying Next.js Apps on Cloudflare
davidgomes.com
davidgomes.com
The "hard" work of creating the Workers technology and service is useless if they don't do the arguably easier (but more tedious) work of getting the ecosystem to play well with Workers. This means making a list of the Top 1000 most popular packages on Node.js, and finding ways to make as many of them work on Workers as possible. For the ones where it's too hard/impossible, there should be *well-documented* alternatives.
JSR also does a good job of indicating what packages work where—if it gains traction.
Also, one thing that isn’t made clear in the documentation is that you cannot test in any real sense. They have buggy, toy PoC testing but there’s no way to do local testing for real world apps.
If you’re making anything more complicated than a blog it gets very painful very quickly.
For my personal blog hosted on Cloudflare I am using Hexo.js - not as cool as Next but does the job and I can deploy it from gitlab using their Ci/Cd pipeline
In, say, the JVM or .NET ecosystems one can limit their dependencies to a handful of libraries that come from reputable sources. What is keeping us from folding some of the basic JavaScript libraries into a few larger ones?
And even more importantly, what evolutional forces have brought us into this state? Is it that frontend developers are more extraverted and share their inferior creations more actively? Are frontend developers more obsessed with shiny new things because they work on the visible parts of software development? Would understanding this help with finding a nice way forward?
I'm aware of things like "npm audit", but with the amount of false positives that spews out, it seems one just has to trust the entire ecosystem.
My intuition keeps telling me that this is a disaster waiting to happen, and I'm trying to understand how this can be so pervasive.
You even say cloudflare is using “nodejs isolates” which they aren’t - they are using v8 isolates, so your expectation of nodejs compatibility is the issue.
https://nextjs.org/docs/app/building-your-application/render...
I am actually comparing Edge deployments on both. I made a lot of points about the Cloudflare overall experience outside of the Edge bit. Obviously, in Vercel you can go with Edge or more regular Node.js, and that flexibility is quite nice.
Also, yes, I meant to say "v8 isolates", that was a typo. (Fixed now)
I found them lacking in the department of logging and debug, my custom tailwind theme minification throws away used style classes even with Safelist specified in tailwind.config.js and I couldn't figure out why - it doesn't happen on my machine. In the end I left tailwind -minify flag out.
To be fair, those are the bare minimum. All of those have been normalised by the likes of Netlify, Vercel, Firebase Hosting (automatic builds are a bit trickier to setup with them, but considering that CI/CD is a free at small scale commodity, hardly a dealbreaker).
Had CloudFlare released a subpar offering it wouldn't have made much sense.
> I found them lacking in the department of logging and debug
Of the builds specifically? Do you know if you can use your own GitHub Action to build and just throw the static html, css and js at CloudFlare?
I didn't know that, how cool, I'll try it this way, thanks!
Even still, there are other Cloudflare products to speak of and altogether they are poorly documented and idiosyncratic. Your Cloudflare code will be very Cloudflare.
Next.js on anything other than Vercel was always dicey.