Skip to content

Commit

Permalink
Use server-runtime for RR repo check
Browse files Browse the repository at this point in the history
  • Loading branch information
markdalgleish committed Apr 24, 2024
1 parent 1afbce2 commit 3d2d1b8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/remix-dev/vite/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1782,9 +1782,15 @@ export const reactRouterVitePlugin: ReactRouterVitePlugin = (_config) => {
};

function isInReactRouterMonorepo() {
let devPath = path.dirname(require.resolve("@react-router/dev/package.json"));
let devParentDir = path.basename(path.resolve(devPath, ".."));
return devParentDir === "packages";
// We use '@react-router/server-runtime' for this check since it's a
// dependency of this package and guaranteed to be in node_modules
let serverRuntimePath = path.dirname(
require.resolve("@react-router/server-runtime/package.json")
);
let serverRuntimeParentDir = path.basename(
path.resolve(serverRuntimePath, "..")
);
return serverRuntimeParentDir === "packages";
}

function isEqualJson(v1: unknown, v2: unknown) {
Expand Down

0 comments on commit 3d2d1b8

Please sign in to comment.