jaydenseric / graphql-upload

Middleware and an Upload scalar to add support for GraphQL multipart requests (file uploads via queries and mutations) to various Node.js GraphQL servers.
https://npm.im/graphql-upload
MIT License
1.43k stars 131 forks source link

MJS is to early to use #330

Closed xelaz closed 2 years ago

xelaz commented 2 years ago

I spent fucking 3 days of my time, to get run my project with your super idea to use MJS in graphql-upload. The first time it sucks with CJS in v15.0.0, then this one.

I can't switch and refactor my project only for your good package wich i use. And i think, there are many developers and enterprise companies, wich has same problem to switch the full stack to MJS.

I spent 3 days to get run my project, its not possible use "type": "module" in package js, or use babel/register or transpile with typescript to commonjs or Next or Node16. It produce only problems. And yes i use node16. But to refactor my 1000 Files its not easy.

Thanks for to spent time for your idea, to switch at first to cjs then mjs....

the next one package is nanoid, same problem, fuck of it, i can reset it with 10 lines of code, but your package is not easy to rewrite and be not more dependet of your package...

THX...

jaydenseric commented 2 years ago

I spent fucking 3 days of my time

So, you are upset to spend a few days, when I have spent literally months and months building all this stuff for you for free. It's cost me tens of thousands in expenses, and potentially hundreds of thousands in opportunity cost because I could have been doing paid contract work for all those months instead. Listen to yourself.

MJS is to early to use

I've been using ESM and the .mjs file extension in production for years.

graphql-upload is a perfectly valid Node.js package, that works with every version of Node.js that isn't EOL. It's published in the standard JavaScript module format (ESM). Absolutely nothing I'm doing is incorrect. Your codebase however is apparently unable to deal with a perfectly standard module; yet you somehow think that's my mistake? Fix your codebase. Your company had years and years to be ready for this.

I don't think you really care about improvements in technology (this issue seems to be mostly motivated about avoiding effort), so I'm not going to spend more of my own effort explaining for the thousandth time the very real reasons moving to pure ESM is necessary and has benefits.

Thanks for to spent time for your idea, to switch at first to cjs then mjs....

I broke up the major changes into seperate versions to make it easier for people to incrementally update and benefit from critical bug fixes, etc. instead of lumping every change into one big major version. You're welcome. I had a clear end goal in mind for all of the changes for a very long time.

the next one package is nanoid, same problem, fuck of it,

You are starting to realise late, that actually the ecosystem is moving to ESM whether you like it or not. You can swear at me and raise toxic issues as much as you like, but you will just be wasting breath as more and more of your dependencies move to pure ESM and it starts to dawn on you that maybe I should have paid more attention over the years and listened to experts that said these things were important.

Do you realise that the next graphql version will be pure ESM?

https://github.com/graphql/graphql-js/releases/tag/v17.0.0-alpha.1

If I kept graphql-upload as CJS then it would be incompatible with graphql v17, and users who are doing the right thing by using standard ESM and keeping graphql up to date would rightfully complain.

You don't understand the complicated things you are complaining about. Be nice.

koresar commented 2 years ago

I feel you both guys.

@xelaz I will keep my fork of graph-upload as CJS compatible forever.

@jaydenseric Thanks for your work mate. I've just applied your utf8 fix to my fork. I am too, like Alexander, is using your work for free.

xelaz commented 2 years ago

Thanks, @koresar , but this is not best workaround. graphql-upload need use same import like graphql package with index.mjs and we can use imports like this again: import {GraphQLUpload} from 'graphql-upload'; and not like this: // @ts-ignore import GraphQLUpload from 'graphql-upload/GraphQLUpload.js'; // @ts-ignore import GraphQLUpload from 'graphql-upload/GraphQLUpload.mjs';

all other 1000 packages wich i use, works without problems...

thanks... and happy coding!