Skip to content

Commit

Permalink
Showing 2 changed files with 13 additions and 12 deletions.
3 changes: 2 additions & 1 deletion packages/astro/src/core/build/index.ts
Original file line number Diff line number Diff line change
@@ -211,7 +211,8 @@ class AstroBuilder {
key: keyPromise,
};

const { internals, ssrOutputChunkNames, ssrOutputAssetNames, contentFileNames } = await viteBuild(opts);
const { internals, ssrOutputChunkNames, ssrOutputAssetNames, contentFileNames } =
await viteBuild(opts);

const hasServerIslands = this.settings.serverIslandNameMap.size > 0;
// Error if there are server islands but no adapter provided.
22 changes: 11 additions & 11 deletions packages/astro/src/core/build/static-build.ts
Original file line number Diff line number Diff line change
@@ -425,17 +425,17 @@ async function ssrMoveAssets(opts: StaticBuildOptions, ssrOutputAssetNames: stri
: opts.settings.config.build.server;
const clientRoot = opts.settings.config.build.client;
if (ssrOutputAssetNames.length > 0) {
await Promise.all(
ssrOutputAssetNames.map(async function moveAsset(filename) {
const currentUrl = new URL(filename, appendForwardSlash(serverRoot.toString()));
const clientUrl = new URL(filename, appendForwardSlash(clientRoot.toString()));
const dir = new URL(path.parse(clientUrl.href).dir);
// It can't find this file because the user defines a custom path
// that includes the folder paths in `assetFileNames`
if (!fs.existsSync(dir)) await fs.promises.mkdir(dir, { recursive: true });
return fs.promises.rename(currentUrl, clientUrl);
}),
);
await Promise.all(
ssrOutputAssetNames.map(async function moveAsset(filename) {
const currentUrl = new URL(filename, appendForwardSlash(serverRoot.toString()));
const clientUrl = new URL(filename, appendForwardSlash(clientRoot.toString()));
const dir = new URL(path.parse(clientUrl.href).dir);
// It can't find this file because the user defines a custom path
// that includes the folder paths in `assetFileNames`
if (!fs.existsSync(dir)) await fs.promises.mkdir(dir, { recursive: true });
return fs.promises.rename(currentUrl, clientUrl);
}),
);
removeEmptyDirs(fileURLToPath(serverRoot));
}
}

0 comments on commit 176fe9f

Please sign in to comment.