Fix Vite build failure on Node.js v20 due to undefined file.parentPath (#35509)

This commit is contained in:
Roni Laukkarinen authored and GitHub committed 2025-07-25 07:59:49 +00:00
1 parent d950298d29
commit 81da377d8e
1 file changed
+4 -2
+4 -2
View File
@@ -193,10 +193,11 @@ async function findEntrypoints() {
withFileTypes: true,
});
const jsExtTest = /\.[jt]sx?$/;
const jsEntrypointsDir = path.resolve(jsRoot, 'entrypoints');
for (const file of jsEntrypoints) {
if (file.isFile() && jsExtTest.test(file.name)) {
entrypoints[file.name.replace(jsExtTest, '')] = path.resolve(
file.parentPath,
jsEntrypointsDir,
file.name,
);
}
@@ -208,10 +209,11 @@ async function findEntrypoints() {
{ withFileTypes: true },
);
const scssExtTest = /\.s?css$/;
const scssEntrypointsDir = path.resolve(jsRoot, 'styles/entrypoints');
for (const file of scssEntrypoints) {
if (file.isFile() && scssExtTest.test(file.name)) {
entrypoints[file.name.replace(scssExtTest, '')] = path.resolve(
file.parentPath,
scssEntrypointsDir,
file.name,
);
}