3 ms·
I understand that importSync() is blocking. That is fine when it is fine. I am a programmer. I can make sync vs async decisions.
by tqwhite 2y ago
I understand that importSync() is blocking. That is fine when it is fine. I am a programmer. I can make sync vs async decisions.
- recursive 2y agoThe browsers would never implement it.
- efilife 2y agoThis is not a talk about browsers, hence the readFileSync examples
- recursive 2y agoThe reason we got here in the first place was trying to standardize the language and its module loading. If you come up with a solution that doesn't work in browsers, we're back to the same thing. Instead of the `require()` polyfill, we'd need the `importSync` polyfill.
- tqwhite 2y agoNor do they have require(). That’s not the point.
- recursive 2y agoAnd the fact that require() is non-standard is why we're talking about ESM now. Node can cook up another non-standard package loading thing whenever they want. It just won't be ESM. And if you don't care what browsers do, then we're not talking about ESM.