Comments (9)
Well that was fun to debug, but in the end I found it. I'm going to leave here my findings in case someone else comes across this.
I had a .ts route that was handling a POST and GET so it was exposing an action and loader.
But inside my action function I was calling a function (let's call it myFunction )
And myFunction was doing in the end something like :
return json({})
It seems that since the function was inside the same file it got treated like client code.
By moving myFunction to another file called myFunction.server.ts and importing it into my route with the action it all got treated on the server and the build is working now.
I tried to explain it the best I could. I'll close this. Thanks @TooTallNate for the quick response.
from remix.
Ya that makes sense. Nice explanation 👍
from remix.
What is the full error you are seeing? Can you share your code?
from remix.
`Error: [commonjs--resolver] Server-only module referenced by client
'./entry.server.js' imported by 'node_modules/@vercel/remix/dist/edge/index.js'
See https://remix.run/docs/en/main/future/vite#splitting-up-client-and-server-code
file: ../node_modules/@vercel/remix/dist/edge/index.js`
Happy to share any code that you think is helpful, or jump on a discord call or something similar.
from remix.
If you can share the code that would be the most helpful. Also note that entry.server
is a special file name in Remix, so if you are trying to import it within one of your routes then it's probably improper usage.
from remix.
I'm using the defaults entry files. I deleted them so I make sure they won't interfere.
Tried a lot of workarounds, different vite configs.
different package managers.
Fails with the same node modules error everytime
from remix.
I mean, it's something in your app code. It's not related to Vite config nor package manager nor even Vercel. You can try working backwards from the starter template which does not exhibit this error. I'd be happy to help diagnose further if you want to share a reproduction.
from remix.
Feels like it, deleted the whole routes files then it failed again, then commented this file
../node_modules/@remix-run/dev/dist/config/defaults/entry.client.tsx
it worked after, so it seems that one of the route might be at fault. trying to find out which one
from remix.
@robipop22 thanks for documenting this.
Ran into this as well with some helper functions, and was just about to give up.
from remix.
Related Issues (20)
- Links have stopped working after deploy HOT 8
- using config export breaks HMR
- vercelPreset changes build directory structure, breaking start script from remix docs HOT 6
- vercel feature flags HOT 7
- how can I gracefully handle FUNCTION_INVOCATION_TIMEOUT HOT 2
- `vercel build` fails in template HOT 2
- Cannot deploy if any route uses the edge runtime HOT 8
- Custom entry.server with Vite not possible HOT 3
- Root route imports are always bundled for edge HOT 1
- Merge Conflict ❌
- 2.9.1? HOT 3
- `TypeError: headers.getSetCookie is not a function` HOT 4
- Merge Conflict ❌
- Deployment to Vercel causes a build panic when using manual route configuration #9431 HOT 1
- Dependencies with multiple entrypoints causes deployment error when targeting Edge runtime HOT 1
- getLoadContext for Vercel does not accept promises.
- support `getLoadContext` when using Vite HOT 3
- npm error: Could not resolve dependency: peer @remix-run/dev@"2.9.1" from @vercel/[email protected] HOT 1
- KV Sessions: Cannot read properties of undefined (reading 'deleteData')
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from remix.