Fix Vite build failure on Node.js v20 due to undefined file.parentPath (#35509)
This commit is contained in:
parent
d950298d29
commit
81da377d8e
@ -193,10 +193,11 @@ async function findEntrypoints() {
|
|||||||
withFileTypes: true,
|
withFileTypes: true,
|
||||||
});
|
});
|
||||||
const jsExtTest = /\.[jt]sx?$/;
|
const jsExtTest = /\.[jt]sx?$/;
|
||||||
|
const jsEntrypointsDir = path.resolve(jsRoot, 'entrypoints');
|
||||||
for (const file of jsEntrypoints) {
|
for (const file of jsEntrypoints) {
|
||||||
if (file.isFile() && jsExtTest.test(file.name)) {
|
if (file.isFile() && jsExtTest.test(file.name)) {
|
||||||
entrypoints[file.name.replace(jsExtTest, '')] = path.resolve(
|
entrypoints[file.name.replace(jsExtTest, '')] = path.resolve(
|
||||||
file.parentPath,
|
jsEntrypointsDir,
|
||||||
file.name,
|
file.name,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -208,10 +209,11 @@ async function findEntrypoints() {
|
|||||||
{ withFileTypes: true },
|
{ withFileTypes: true },
|
||||||
);
|
);
|
||||||
const scssExtTest = /\.s?css$/;
|
const scssExtTest = /\.s?css$/;
|
||||||
|
const scssEntrypointsDir = path.resolve(jsRoot, 'styles/entrypoints');
|
||||||
for (const file of scssEntrypoints) {
|
for (const file of scssEntrypoints) {
|
||||||
if (file.isFile() && scssExtTest.test(file.name)) {
|
if (file.isFile() && scssExtTest.test(file.name)) {
|
||||||
entrypoints[file.name.replace(scssExtTest, '')] = path.resolve(
|
entrypoints[file.name.replace(scssExtTest, '')] = path.resolve(
|
||||||
file.parentPath,
|
scssEntrypointsDir,
|
||||||
file.name,
|
file.name,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user