As supporting both #CommonJS and #ESModules can be wrongly done in a thousand ways, I published why and how we achieved that on fast-check. #JavaScript #opensource
This article is a follow-up of issues reported via #publint from @bluwy and fixed thank to @AndaristRake. As making the package right was not an easy game at first glance, I thought that a how-we-do article could help other #maintainers.
https://fast-check.dev/blog/2023/09/04/dual-packages-or-supporting-both-cjs-and-esm/
#CommonJS #esmodules #javascript #opensource #publint #maintainers
I think that there's a backlash coming; we've been #bundling for so long and dealing with all the complications that arise from it, but now we have #ESModules, #HTTP3, and #edge #CDN. Smaller files that change less often are actually better now! The #web is about to #unbundle/#unpack!
#unbundle #web #cdn #edge #http3 #esmodules #bundling
There are honest reasons that people started using and still use #reactjs; I lived through Angular, and Backbone don't try to tell me there weren't reasons!
I still think we should re-evaluate those reasons, because things have changed; we have #ESModules now, #webcomponents #shadowdom etc.
I don't care about web performance, I just want to build websites with a team of people and not have a bunch of indeterminate UI behavior. React delivered the hell out of that, can the post-React stack?
#shadowdom #webcomponents #esmodules #reactjs
What could we do if the #web spec supported defining multiple #ESModules in the same file? I wonder if that would allow runtime linking of chunked #JavaScript in more flexible ways than the format can currently support? I'm imagining a syntax like:
```
// File: /user.js
// No need to request /logger.js, just
// inline it the first time it's needed.
module '/logger.js' {
export function log() { }
}
// Define `/user.js` module.
import { log } from '/logger.js';
function logUser() { }
```
```
// File: /analytics.js
// Can reuse '/logger.js' without having
// to download it separately.
import { log } from '/logger.js';
function collect() { }
```
This way servers could trivially move '/logger.js' between '/user.js' or '/analytics.js' at runtime per-user based on whatever chunk the user downloaded first.
https://github.com/tc39/proposal-module-declarations seems to explore this, though everything is lexically bound so I don't see how you could support this particular use case. Maybe I'm missing something?
RT @bramusblog@twitter.com
Control the behavior of JavaScript imports with Import Maps
🔗 https://www.bram.us/2021/03/03/control-the-behavior-of-javascript-imports-with-import-maps/
🏷 #EsModules #import #javascript
🐦🔗: https://twitter.com/bramusblog/status/1367080929286631427
#javascript #import #esmodules
RT @aganglada@twitter.com
Must see/read 🔥🔥🔥💯 #esmodules #modernjs #AMAZING https://twitter.com/Lady_Ada_King/status/1007625738844065793