Unable to build remix while using absolute paths outside of the app
directory with custom routes in vite.config.ts
#10024
Labels
app
directory with custom routes in vite.config.ts
#10024
Reproduction
System Info
Used Package Manager
yarn
Expected Behavior
I'm trying to build a Remix app by defining custom routes outside of the
app
directory. When I run it in DEV mode, things seem to be working fine, but when I try to build it I get some issues when the server manifest is trying to be built. I would expect if I define a route such as the below, that the absolute path would resolve correctly and the server bundle manifest would compile correctly.Let's say I define an index route like the below:
Actual Behavior
Client building works fine, but when the
ssr
is true and vite attempts to build the server bundles, the asbolute of the routes are being prepended with the absoluteapp
directory. I've done some tracing and found what I believe to be issue to be here:https://github.com/remix-run/remix/blob/9d68bb37a26ebec92be819ba23e21332707a8bcc/packages/remix-dev/vite/plugin.ts#L873C11-L873C24
in the
generateRemixManifestsForBuild
of the vite plugin, the absolute file path is being joined to the app directory which results in a theroute.file
being incorrect.The
route.file
from thedefineRoutes
function is/Users/user_name/absolute/path/to/route/file
, but when it's joined with thectx.remixConfig.appDirectory
, it then becomes/Users/user_name/absolute/path/to/route/file/app/Users/user_name/absolute/path/to/route/file.tsx
.This in turn then fails the lookup for the manifest since the manifest key is relative
This then throws the
No manifest entry found
error since the absolute filepath doesn't match the relative key the manifest was created with.My question is... does remix have a way around this or is this really a bug?
The text was updated successfully, but these errors were encountered: