[HN Gopher] WinterCG: Web-Interoperable Runtimes Community Group ___________________________________________________________________ WinterCG: Web-Interoperable Runtimes Community Group Author : brianzelip Score : 35 points Date : 2022-08-13 19:37 UTC (3 hours ago) (HTM) web link (wintercg.org) (TXT) w3m dump (wintercg.org) | josephg wrote: | This is really important work to get things like WASM off the | ground. Recently I've been working on a rust library I want to be | able to run in the browser and from nodejs via wasm. | | But its way harder than it should be. Wasm-pack has a different | target for nodejs and the browser for ridiculous reasons - like | 'crypto' and 'WebSocket' being globally available objects in the | browser but not in nodejs. And es modules working slightly | differently in each environment. Npm is designed assuming | packages will be isomorphic. I've ended up with separate -node | and -web packages - which makes my code feel non-native. | | You shouldn't need to care that a JS package uses wasm | internally. But these little points of incompatibility really | hurt wasm as a target for libraries to use. | zdragnar wrote: | NPM has always been node-first, and relied on tools such as | browserify to make some packages more portable - bower was | significantly more popular for front end development until it | came around. | | CJS was node's solution to "modules" prior to ES modules, which | was not interoperable with requirejs / AMD, the front end | solution that came out of Dojo. UMD offered a way to have both, | but was far too much boilerplate to support by hand, so it was | mostly only adopted by libraries. | | CJS won out for a very short time, right up until import / | export became available via webpack. This short window is | pretty much the only time that "isomorphic" really applied to | NPM; by the time import / export had gained enough steam | (thanks largely to both webpack and typescript for jump | starting adoptation), there were enough browser modules that | trying to write truly isomorphic code was limited to certain | subsets of your application. | | I imagine running isomorphic code under deno to be quite a bit | less painful, as it was built from the ground up to mirror | browser environments as closely as possible, but that's not | much consolation if you still want to target node. | ricklamers wrote: | This reminds me of the slogan of ISO: Great things happen when | the world agrees | brianzelip wrote: | Listen to context about this (tl;dr, the growing number of | deployment targets for modern apps/libs/frameworks) from the | recent Syntax podcast. | | See the 27:01 mark, https://syntax.fm/show/496/supper-club- | headless-ecommerce-wi.... ___________________________________________________________________ (page generated 2022-08-13 23:00 UTC)