Skip to content

Commit 4f597b9

Browse files
Normalize dirent entry path across node versions
1 parent 8389d48 commit 4f597b9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/react-router-dev/vite/plugin.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,10 +810,15 @@ export const reactRouterVitePlugin: ReactRouterVitePlugin = () => {
810810
let sriManifest: ReactRouterManifest["sri"] = {};
811811
for (const entry of entries) {
812812
if (entry.isFile() && entry.name.endsWith(".js")) {
813+
const entryNormalizedPath =
814+
"parentPath" in entry && typeof entry.parentPath === "string"
815+
? entry.parentPath
816+
: entry.path;
817+
813818
let contents;
814819
try {
815820
contents = await fse.readFile(
816-
path.join(entry.path, entry.name),
821+
path.join(entryNormalizedPath, entry.name),
817822
"utf-8"
818823
);
819824
} catch (e) {
@@ -825,7 +830,7 @@ export const reactRouterVitePlugin: ReactRouterVitePlugin = () => {
825830
.digest()
826831
.toString("base64");
827832
let filepath = getVite().normalizePath(
828-
path.relative(clientBuildDirectory, path.join(entry.path, entry.name))
833+
path.relative(clientBuildDirectory, path.join(entryNormalizedPath, entry.name))
829834
);
830835
sriManifest[`${ctx.publicPath}${filepath}`] = `sha384-${hash}`;
831836
}

0 commit comments

Comments
 (0)