Live data from Hacker News

Modern SPAs without bundlers, CDNs, or Node.js

kofi.sexy

1–10 of 170 posts

Re: Modern SPAs without bundlers, CDNs, or Node.js

#6
post #5
post #3

Earlier quoted context omitted.

No Safari support seems like a significant hurdle.

Safari support is enabled with https://github.com/guybedford/es-module-shims

I’m the post author, and I use this same polyfill. I even install it with the same NPM download method I wrote about.

Re: Modern SPAs without bundlers, CDNs, or Node.js

#7
post #4

Woah, importmap is a game changer! I didn't know about it until reading this, thanks!

Not yet available on Safari, but still cool! https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sc...

https://github.com/guybedford/es-module-shims has a polyfill.

(But it is fairly large: 53KB raw, 15KB gzipped, 32KB minified, 11KB minified+gzipped. It’s providing a lot of likely-unnecessary functionality. I’d prefer a stripped-down and reworked polyfill that can also be lazily-loaded, controlled by a snippet of at most a few hundred bytes that you can drop into the document, only loading the polyfill in the uncommon case that it’s needed—like how five years ago as part of modernising some of the code of Fastmail’s webmail, I had it fetch and execute core-js before loading the rest iff !Object.values (choosing that as a convenient baseline—see https://www.fastmail.com/blog/using-the-modern-web-platform/... for more details), so that the cost to new browsers of supporting old browsers was a single trivial branch, and maybe fifty bytes in added payload. I dislike polyfills slowing down browsers that don’t need them, by adding undue weight or extra requests.)

Re: Modern SPAs without bundlers, CDNs, or Node.js

#8
post #4

Woah, importmap is a game changer! I didn't know about it until reading this, thanks!

Not yet available on Safari, but still cool! https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sc...

That's going to change when Safari 16.4 comes out - currently in beta: https://developer.apple.com/documentation/safari-release-not...

Re: Modern SPAs without bundlers, CDNs, or Node.js

#9
I also sometimes enjoy this approach of starting from absolutely nothing.

Instead of taking the path of starting with DOM manipulation and then going to a framework as necessary, I've kept really trying to make raw web components work, but kept finding that I wanted just a little bit more.

I managed to get the more I wanted -- sensible template interpolation with event binding -- boiled down to a tag function in 481 bytes / 12 lines of (dense) source code, which I feel like is small enough that you can copy/paste it around and not feel to bad about it. It's here if anyone cares to look: https://github.com/dchester/yhtml

Re: Modern SPAs without bundlers, CDNs, or Node.js

#10
well sure, client side reliable ES means we can drop all this compiled and packed stuff

but bold move cotton

nice to see there is a polyfill

I’ll think about it for my next side project, but I’ll probably just do something I can add to my React + Node portfolio on github because recruiters and employers won’t know about this until 2027

Post reply on HN