mirror of
https://github.com/yingziwu/mastodon.git
synced 2026-02-04 03:25:14 +00:00
Fix unnecessary duplication in vite code for finding entrypoints (#35515)
This commit is contained in:
parent
5a88b7f683
commit
e93efe0e13
1 changed files with 6 additions and 7 deletions
|
|
@ -189,11 +189,11 @@ async function findEntrypoints() {
|
|||
const entrypoints: Record<string, string> = {};
|
||||
|
||||
// First, JS entrypoints
|
||||
const jsEntrypoints = await readdir(path.resolve(jsRoot, 'entrypoints'), {
|
||||
const jsEntrypointsDir = path.resolve(jsRoot, 'entrypoints');
|
||||
const jsEntrypoints = await readdir(jsEntrypointsDir, {
|
||||
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(
|
||||
|
|
@ -204,12 +204,11 @@ async function findEntrypoints() {
|
|||
}
|
||||
|
||||
// Next, SCSS entrypoints
|
||||
const scssEntrypoints = await readdir(
|
||||
path.resolve(jsRoot, 'styles/entrypoints'),
|
||||
{ withFileTypes: true },
|
||||
);
|
||||
const scssExtTest = /\.s?css$/;
|
||||
const scssEntrypointsDir = path.resolve(jsRoot, 'styles/entrypoints');
|
||||
const scssEntrypoints = await readdir(scssEntrypointsDir, {
|
||||
withFileTypes: true,
|
||||
});
|
||||
const scssExtTest = /\.s?css$/;
|
||||
for (const file of scssEntrypoints) {
|
||||
if (file.isFile() && scssExtTest.test(file.name)) {
|
||||
entrypoints[file.name.replace(scssExtTest, '')] = path.resolve(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue