4 ms·
80% of typescript modules don’t export esm? What? Most people write code using esm for the past few years. If anything the problem is that shared libraries are
by zackify 4y ago
80% of typescript modules don’t export esm? What?
Most people write code using esm for the past few years. If anything the problem is that shared libraries are only exporting esm so tools like jest that still require commonjs don’t work.
Just use Tsdx or other tooling to automatically expose the different bundle types.
Even still, if JS developers took the time to understand the different module types we would be in a much better place on the shared packages front
- rektide 4y ago> Most people write code using esm for the past few years. But what do they target? TypeScript projects targetting only es2015 or only cjs are all too numerous. Much of nobility of this Type Annotations work is we could (potentially) stop transpiling. The source could be the source. > Just use Tsdx Just use ____ is the center square of the JS bingo game. It's a terrible answer, but it's almost always the answer, and the answer always changes. That there's an ever rotating constellation of "just use" answers to newcomers questions, all of which are semi-required "zero configuration" "just works" new tools to fix the previous pile of cobbled together stuff: painfully Python-esque.
- codethief 4y ago> painfully Python-esque I agreed with every single thing you wrote until that last line. In what universe is the ever-changing mess that is the JavaScript ecosystem even remotely comparable to the Python ecosystem?
- rektide 4y agoA not unreasonable call out at all. The multi-layers of pip, setuptools, easy_install, virtualenv stuff made me very sad at the time. Nodejs was such a relief at the time. My understanding is recently Python docs have started to encorporate a little more guidance on handling dependencies in virtualenvs, and some specific suggestions & write up about tools. Which is great. I think your right that JS probably has a lot more build/compiling/lifting machinery, & is much more confusing. To be fair, it also has a much harder job (since the build-target is only sometimes the local machine).
- paustint 4y agoThe confusing thing is that even though we have all been writing import statements in Typescript, that is not the same as ESM. Now, even though we all think we have been using ESM, when libraries only export ESM our tools/build chains are not compatible. This episode isn't 100% current, but still relevant and discusses this issue: https://changelog.com/jsparty/137 https://changelog.com/jsparty/137