Skip to content
Discussion options

You must be logged in to vote

I think I've figured this out now. The solution is to (1) add your routes to optimizeDeps.entries as suggested by @hi-ogawa and then (2) patch packages/remix-dev/vite/plugin.ts:

 {
   name: "remix-dot-server",
   enforce: "pre",
   resolveId(id, importer, options) {
+     if (options?.scan) return // might need @ts-expect-error for this
     // ... rest of the plugin code ...
   }
 }

The issue was that the if (options?.ssr) return check was not being triggered during dependency optimization since the ssr field is omitted from the options during that pass. So to fix it, we can detect if the optimization pass is happening directly via options?.scan.

Going to verify that this is the fix and …

Replies: 5 comments 23 replies

Comment options

You must be logged in to vote
1 reply
@jansedlon
Comment options

Comment options

You must be logged in to vote
19 replies
@caprica
Comment options

@clayton-kenney
Comment options

@khera
Comment options

@pcattori
Comment options

Answer selected by pcattori
@edbella
Comment options

@pcattori
Comment options

@edbella
Comment options

@atticoos
Comment options

Comment options

You must be logged in to vote
1 reply
@jrestall
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@jansedlon
Comment options

@onozaty
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet