diff --git a/packages/astro/src/core/build/static-build.ts b/packages/astro/src/core/build/static-build.ts index 1536d9155..13f40c8da 100644 --- a/packages/astro/src/core/build/static-build.ts +++ b/packages/astro/src/core/build/static-build.ts @@ -2,7 +2,6 @@ import * as eslexer from 'es-module-lexer'; import glob from 'fast-glob'; import fs from 'fs'; import { bgGreen, bgMagenta, black, dim } from 'kleur/colors'; -import path from 'path'; import { fileURLToPath } from 'url'; import * as vite from 'vite'; import { astroBundleDelayedAssetPlugin } from '../../content/index.js'; @@ -10,9 +9,8 @@ import { BuildInternals, createBuildInternals, eachPrerenderedPageData, - isHoistedScript, } from '../../core/build/internal.js'; -import { emptyDir, removeDir, removeEmptyDirs } from '../../core/fs/index.js'; +import { emptyDir, removeEmptyDirs } from '../../core/fs/index.js'; import { appendForwardSlash, prependForwardSlash } from '../../core/path.js'; import { isModeServerWithNoAdapter } from '../../core/util.js'; import { runHookBuildSetup } from '../../integrations/index.js'; diff --git a/packages/astro/src/core/fs/index.ts b/packages/astro/src/core/fs/index.ts index 4b627a3eb..35afde043 100644 --- a/packages/astro/src/core/fs/index.ts +++ b/packages/astro/src/core/fs/index.ts @@ -15,12 +15,12 @@ export function removeEmptyDirs(root: URL): void { const dir = fileURLToPath(root); if (!fs.statSync(dir).isDirectory()) return; let files = fs.readdirSync(dir); - + if (files.length > 0) { - files.map(file => { + files.map((file) => { const url = new URL(`./${file}`, appendForwardSlash(root.toString())); removeEmptyDirs(url); - }) + }); files = fs.readdirSync(dir); } diff --git a/packages/integrations/image/src/build/ssg.ts b/packages/integrations/image/src/build/ssg.ts index 4d5087011..b432447e3 100644 --- a/packages/integrations/image/src/build/ssg.ts +++ b/packages/integrations/image/src/build/ssg.ts @@ -172,7 +172,10 @@ export async function ssgBuild({ let outputFileURL: URL; if (isRemoteImage(src)) { - outputFileURL = new URL(path.join(`./${config.build.assets}`, path.basename(filename)), outDir); + outputFileURL = new URL( + path.join(`./${config.build.assets}`, path.basename(filename)), + outDir + ); outputFile = fileURLToPath(outputFileURL); } else { outputFileURL = new URL(path.join(`./${config.build.assets}`, filename), outDir);