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

This commit is contained in:
Roni Laukkarinen 2025-07-25 10:59:49 +03:00 committed by GitHub
parent d950298d29
commit 81da377d8e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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,
);
}