I know title is little baity but hear me out. This is my cry of the soul because things are bad, for reasons I’d have assumed of me doing something wrong, weren’t it for the fact that no one experienced say anything useful on the matter.
I’m not really a web-dev, I’m more of a low-level guy, though with very broad experience (web-dev unrelated). Just so happened I’m doing web-devel ATM.
One thing I can see is that SPA is typically a poor design, because user typically wouldn’t want to wait for megabytes of data just to view the front page. Most popular websites out there are MPAs, except perhaps web-apps, like draw.io. It makes sense for WEB-programming to be MPA first, and SPA be a second-class citizen. I recall this seems to be the case with PHP.
PureScript tutorials seem to be SPA-first: you create a index.js
, and it contains whole world (I disregard here those that do a npm run …
to start a browser, because it’s clearly debug-only. In production you’d have js or ideally html files to be fetched by the backend).
And somehow I ended up pioneering the technology that should’ve always existed! I was the first person in the recorded history to ask such basic question as “how to produce multiple outputs/pages with PureScript”. You can look up my answer there for details, but in short: PureScript support for this is basically non-existent: being done via bundle-module
it depends on some hacks and requires writing a build system around build system!
Per my understanding the post was read by more than one actually experienced person, and no other commentary or answers were posted. Furthermore, my “heavy-lifting” answer got a downvote, whereas the dude’s answer that ain’t worth a cent (which is just “try using bundle-module
”, doesn’t work as is as you can see by my ignored comments under, and should’ve been just a comment) somehow got an upvote, both done judging by the delay by different people. That confuses me even further. Did I do something wrong, was there a better way…? No one has commented anything The question per se was also downvoted (someone upvoted it later), despite being so important for the ecosystem.
Two weeks ago story continued with this post: I’m trying to add a JS lib and FFI is not working for me. Discussion got kinda offtopic there, but the results as of writing the words are in the first 2 comments: “Use relative paths” — “Oh, yeah, it works…! Well, not really: works for bundle-app
, doesn’t for bundle-module
”.
bundle-module
treats JS code as ESM format, and from research I done it seems to totally make sense (i.e. it’s exactly the format that should be used). However, ESM format is very limited, meaning that you can’t FFI a random JS lib this way. But you need FFI!
I haven’t really dug into the lower-level to see if it’s possible to come up with some crazy trick. But offhand this really seem to be a fundamental incompatibility with bundle-module
. And it is the 2nd serious problem for such simple basic usecase that most websites out there adhere to!
So what gives, is PureScript really just incompatbile with MPA and people are just being people, being evasive and rude? Or is there still some sacred knowledge, some dark mysterious hidden wisdom, inaccessible to uninitiated, prohibited to look upon by bystanders…?