Toby's Log page 23

JS: ES Modules and Node bare specifiers via response rewrite

I’ve been playing with JS lately, including ES modules and building with Rollup, Babel, and Terser, along with other accessories. One thing I’m disappointed with of ES modules in the Nodejs ecosystem is dealing with third party imports. Using the “bare” specifiers that Node expects works fine in that environment and thus tools running in it (possibly needing helpers), but they don’t work at all directly in the browser. This is discussed in this post by Jake Archibold, for instance.

Import maps are one solution in the works, but that requires explicitly mapping every dependency, which could get complicated fast when dependencies have dependencies. It also is only in draft stage and only works in Blink based browsers currently.

I eventually gave in to the idea of having server code rewrite the paths in the js file responses to point to a symlinked node_modules folder, similar to what is mentioned in this post by the Polymer project. I created a PHP test server for one of my projects that does this.

Continue reading post "JS: ES Modules and Node bare specifiers via response rewrite"

Purchase: flannel sherpa lined robe

I finally bought myself an expensive but very warm and comfy bath robe, LL Bean’s sherpa lined flannel robe, the black watch color. I don’t think I’ve had a robe since I was a kid. I’ve considered getting one for years, but couldn’t find one in stores that didn’t look too cheap and thin or was too expensive. But the advantages finally won out and made an expensive one seem worth it.

Continue reading post "Purchase: flannel sherpa lined robe"