They still have not fixed insects according to ESM enterprise segments (age

2nd.js in addition to their incapacity in order to techniques absolute ESM dependencies is actually the brand new cause I didn’t move the my very own Second.js / front related packages so you’re able to sheer ESM. g. vercel/second.js#17806), nonetheless they features repaired assistance to own pure ESM dependencies that was part of the disease. Consequently, You will find went to come recent years weeks and converted multiple way more packages so you can sheer ESM. After a while, others will do an identical as well.

I’ve got no sympathy for all those that were counting on Jest’s capacity to transpile supply towards the fly and you can bang doing that have concerns of one’s runtime by the hacking the latest imports, rather than assessment the actual shipping password properly via assessment you to are regular JS modules that don’t you would like an alternative engine other than simply Node.js to run. No matter, one way or another Jest usually eliminate most of the Node.js ESM compat activities as it’s a keen existential matter towards the viability into the tool, otherwise anybody is rewrite the tests.

jimmywarting commented •

I’d perhaps not label cjs depricated. heritage is actually a very best phrase because of it. it does almost certainly never ever go-away to have a foreseeable future but new code should start to having fun with esm automatically now.

Off my own knowledge we in the node-fetch fist wished to fool around with transfer and in case we planned to provides dual assistance this may be meant that we would have to convert that which you back into cjs (actually sup https://datingmentor.org/nobody-review/ dependencies), and this we don’t want to do any further. We didn’t must content all our password. therefore we don’t need to reintroduce good compiler. And then we now in addition to confidence almost every other esm simply bundles. whenever we planned to has actually dual service at this stage today it designed that people will have to implant the sub dependencies on the node-bring and transpile these to cjs also to keep a beneficial very own copy for our care about, that will duplicate all password and you will categories and you will affect occasions. If someone where you should rely on a similar type of one of your societal kinds otherwise sup packages (formdata, heading, blob, document, abortsignal whatwg streams) or almost any it carry out just be contradictory which have instanceof checks and you will node-get would-be trapped using one interior sort of that package even if you trust particular brand new type.

dual service is merely a threat that i want to avoid. cjs don’t work in almost any other env except that NodeJS and you will NodeJS supporting ESM now why do you to definitely want to use cjs nevertheless? NodeJS is not necessarily the only system, builders need its password to function cross most other env also, even though you created some thing for the cjs that was solamente built to run in NodeJS, up coming there is going to often be this one man who are supposed to like to which you oriented it ESM for them to import it without npm otherwise one bundler having Deno or even the Browaser.

I agree with you particular typescript user think they normally use esm whilst in facts they are transpiling so you can cjs without knowing it

Anyone has to start converting so you’re able to absolute ESM will eventually. We can’t sitt up to and loose time waiting for all of the 23k bundles exactly who depend on node-get to change to help you esm very first. Or perhaps the almost every other ways as much as. We simply cannot sitt around and you can watch for sandwich dependencies otherwise make equipment to end up being ESM basic. Therefore can not control just how gulp, webpack, jest, rollup, typescript, babel, etc all deal with cjs and esm. after that we might getting stuck which have cjs/twin bundles forever.

It’s simply a poultry therefore the egg paradox out-of exactly who would be to become ESM earliest. typescript or any other have traditionally adhere truth be told there lead throughout the mud on expansion faster paths and you may believe cjs to respond to the brand new roadway. So it can’t remain such as this as soon as we has remote highway resolver which can be dynamic lazy brought in