Closed fcosrno closed 1 week ago
I see this problem too. The uploadHandler function is executed in development, but not on a production build.
I see this problem too. The uploadHandler function is executed in development, but not on a production build.
The fix is to stop using remix-serve, because it calls installGlobals which is causing the issue.
I found an issue in the archived repo that described this problem and solution. Here's how to switch from remix-serve to express: https://remix.run/docs/en/main/start/quickstart
Ah, good find.
But is this still the case if Single Fetch is enabled? I assumed if you enable single fetch it should remove installGlobals. Per the Single Fetch documentation:
If you are using
remix-serve
, it will useundici
automatically if Single Fetch is enabled.
Am I missing something else?
Just make sure you're not using the installGlobals()
polyfill and you should be good to go.
@mjackson is the suggested solution to switch from remix-serve
to e.g. express
?
@fcosrno, using single fetch with remix-serve
still calls installGlobals, but it uses native fetch. I had the same problem as you, but using express instead of remix-serve
resolved it.
Hi there!
Thank you so much for form-data-parser and the other packages in remix-the-web. I'm using them to build a gallery route in an internal CMS. Good stuff. Unfortunately, I'm having issues with form-data-parser not working on build. Works fine in
npm run dev
, so the break came as a surprise.Steps to recreate:
TLDR; Here's a repo.
Or
Create a fresh Remix install using node v20.18.0 (npm v10.8.2):
npx create-remix@latest
Install remix-the-web packages:
npm i @mjackson/file-storage @mjackson/form-data-parser
Create
app/filestorage.server.ts
:And
app/routes/tinker.tsx
:Run
npm run dev
and navigate tohttp://localhost:5173/tinker
. Upload a file. Server logs something like:It works! Onwards. Now run
npm run build
followed bynpm run start
and navigate tohttp://localhost:3000/tinker
. Upload a file. Server log shows something like:What's different between the two? Is Vite tree-shakin' some goodies out? Is there something else I should be looking at?
Thanks again! Remix is awesome.