Replies: 1 comment
-
any solution?
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey folks, I hope you're right.
I encountered the following, and I'd love to hear opinions on that.
I started a Remix project (no stack) and chose to deploy on vercel inside a workspace controlled by
pnpm
.In this project, I use a dependency called
query-string
to handle some parameters.This dependency, however, is full ESM, which means I need to include it on my
serverDependenciesToBundle
.While running it locally, it complained to me because one of the
query-string
dependencies also ESM (filter-obj
). Then I went again toserverDependenciesToBundle
and added this other ESM lib.Locally (running
@remix/server
), everything works just fine, however, when I ship the code to Vercel, the function throws an error saying:After some debugging, I noticed that this is because when I added
query-string
to be bundled, it was included in the output files (root/api/index.js
), but its dependencies (listed on its package.json) were just being "required":My guess is because this is a dependency of a dependency (query-string), when it tries to require, and this is not listed on my package.json, node cannot find it, especially because I'm using
pnpm
and it doesn't flat thenode_modules
.My workaround was adding all dependencies of
query-string
to be bundled up, and now everything is working again, but I was wondering if there's a better (scalable) way of doing this.For comparison, I have the exact same project in NextJS, and I don't have to either include this dependency to be bundled and everything works just fine, probably because of the way the bundle is generated.
Beta Was this translation helpful? Give feedback.
All reactions