Thông tin sản phẩm
2nd.js in addition to their incapacity so you’re able to techniques absolute ESM dependencies is actually the brand new reasoning I did not move the my very own 2nd.js / front end relevant bundles to pure ESM. grams. vercel/2nd.js#17806), nonetheless provides fixed service getting pure ESM dependencies that was part of the state. Correctly, You will find moved to come recent years months and you may converted several significantly more bundles so you can sheer ESM. After a while, other people perform a comparable too.
You will find had no empathy for all of us which were depending on Jest’s power to transpile source to your travel and you may bang doing that have issues of your own runtime by hacking the brand new imports, instead of investigations the genuine delivery password securely through evaluating you to definitely is normal JS modules which do not you would like a different motor almost every other than just Node.js to perform. It doesn’t matter, somehow Jest tend to resolve all of the Node.js ESM compat items because it’s an existential question on the viability on the equipment, otherwise some one can also be write the examination.
jimmywarting stated •
I would personally maybe not name cjs depricated. heritage try a very right word for this. it does probably never disappear completely having a foreseeable future but the brand new password should beginning to playing with esm by default today.
Of my very own event i at node-fetch little finger planned to explore import and in case i wished to possess dual assistance then it implied we would have to transfer everything returning to cjs (actually sup dependencies), and this we don’t need to do any more. I did not want to content our password. so we failed to need certainly to reintroduce a compiler. And we today and additionally rely on almost every other esm just packages. if we wanted to possess dual assistance at this point now this may be created that individuals would need to embed all of our sandwich dependencies to the node-bring and you will transpile these to cjs too to save an excellent individual backup for our mind, which may backup every code and you will groups and you may hinder era. If someone else the best place to rely on the same style of any of your personal categories or sup packages (formdata, header, blob, file, abortsignal whatwg channels) otherwise any it would you should be conflicting which have instanceof checks and you may node-bring could well be stuck on one inner variety of you to definitely package you might depend on some newer adaptation.
dual service is just a threat that i want to avoid. cjs aren’t effective in any other env aside from NodeJS and NodeJS supporting ESM today why would you to definitely want to make use of cjs still? NodeJS is not the just platform, developers wanted their password to focus get across almost every other env too, even although you built one thing into the cjs that has been solo depending to perform when you look at the NodeJS, upcoming there will be this package boy who are going in order to wanna that you established it ESM so they can transfer they without npm or people bundler to have Deno or perhaps the Browaser.
I go along with your some typescript user envision they normally use esm during reality he’s transpiling so you can cjs without even understanding they
Anyone should begin transforming to help you pure ESM at some point. We cannot sitt to and you can loose time waiting for the 23k bundles which count on node-get to alter to help you esm very first. Or even the almost every other ways doing. We cannot sitt around and you may await sandwich dependencies otherwise create products to all the feel ESM very first. And we are unable to control just how gulp, webpack, jest, rollup, typescript, babel, an such like most of the manage cjs and you may esm. up coming we possibly may become caught with cjs/dual bundles permanently.
It is simply a chicken additionally the eggs contradiction away from just who would be to convert to ESM basic. typescript and other have traditionally adhere truth be told there direct regarding mud about expansion reduced pathways and you may depend on cjs to resolve the path. That it can not continue like this as soon as we have remote roadway resolver that will be active lazy brought in