4 ms·
Why does import have to work with cjs? It doesn't in the browser. Why does require have to work esm? Why not just have a package up it's major semver and those
by tokyodude 8y ago
Why does import have to work with cjs? It doesn't in the browser. Why does require have to work esm?
Why not just have a package up it's major semver and those packages that want to start using it need to import it? That seems no different than the browser. AFAIK you can't import a non-module and you can't non-import a module in the browser or am I wrong?
- snek 8y ago>Why does import have to work with cjs? It doesn't in the browser. Why does require have to work esm? `import` doesn't have to work with cjs, but we want to do so because there is so much code in the ecosystem that is cjs. `require` won't and can't work with esm, because esm resolution is async and require resolution is sync.
- ricardobeat 8y agoLet this be solved in userland through compilers, like everyone already does today. The stubbornness from current node maintainers on this subject is astounding. Years of feedback, like you see in this thread, ‘but-what-if’ and ‘you-dont-get-it’ handwaved away.