octet-stream / form-data

Spec-compliant FormData implementation for Node.js
https://www.npmjs.com/package/formdata-node
MIT License
142 stars 17 forks source link

You don't need Babel with target engine set to 10.17 #19

Closed tinovyatkin closed 4 years ago

tinovyatkin commented 4 years ago

Much less @babel/runtime included into production dependencies.

Also, generated .mjs are broken because real ECMAScript imports must include file extensions.

octet-stream commented 4 years ago

Yeah, that was the initial plan – to drop Babel quite some time in a future, when Node will expose and async iterators. But I'm still using it at least for public fields (they sure could be moved to the constructor or accessors, this't not a big deal for me) and to bundle ESM along with the CommonJS distro.

Also, generated .mjs are broken because real ECMAScript imports must include file extensions.

I don't know, the initial support was added here https://github.com/octet-stream/form-data/pull/3 and I'm not actually using these in my projects. And yeah, it doesn't seem to work anymore.

octet-stream commented 4 years ago

Also, while I expose ESM in the package distro along with CommonJS I want to keep backward capability with the CJS due to https://github.com/octet-stream/form-data/issues/6

tinovyatkin commented 4 years ago

Check how it was archived by me at https://github.com/node-fetch/node-fetch/pull/805

octet-stream commented 4 years ago

Looks nice, but I'm not a huge fan of distributing sources and bundled all-in-one file when I'm making Node.js modules. Basically all I need is to compile ES modules down to CJS and replace all .js or .mjs in paths with .cjs. I will take a look if I can achieve that and keep the module's structure.

jimmywarting commented 4 years ago

no huge fan of bundling everything either...

octet-stream commented 4 years ago

Probably I'll just end up removing ESM support and that's that, since the package have only default export. As far as I can tell, you can use CJS packages with ESM modules (am I right?), so having ESM now does not have any sense for me. I will return to ESM support in a future. Also I will drop Babel as you proposed.

octet-stream commented 4 years ago

Babel has been removed from the project. You can try now https://github.com/octet-stream/form-data/releases/tag/v2.3.0