diff --git a/packages/astro/src/core/build/static-build.ts b/packages/astro/src/core/build/static-build.ts index cb46d087935c..a8023f052313 100644 --- a/packages/astro/src/core/build/static-build.ts +++ b/packages/astro/src/core/build/static-build.ts @@ -134,7 +134,7 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp input: [], output: { format: 'esm', - chunkFileNames: `[name].[hash].mjs`, + chunkFileNames: `chunks/[name].[hash].mjs`, assetFileNames: `${settings.config.build.assets}/[name].[hash][extname]`, ...viteConfig.build?.rollupOptions?.output, entryFileNames: opts.buildConfig.serverEntry, diff --git a/packages/integrations/deno/src/index.ts b/packages/integrations/deno/src/index.ts index adee27101490..82da151888cd 100644 --- a/packages/integrations/deno/src/index.ts +++ b/packages/integrations/deno/src/index.ts @@ -87,7 +87,7 @@ export default function createIntegration(args?: Options): AstroIntegration { // Remove chunks, if they exist. Since we have bundled via esbuild these chunks are trash. try { const chunkFileNames = - _vite?.build?.rollupOptions?.output?.chunkFileNames ?? `${_buildConfig.assets}/chunks/chunk.[hash].mjs`; + _vite?.build?.rollupOptions?.output?.chunkFileNames ?? `chunks/chunk.[hash].mjs`; const chunkPath = npath.dirname(chunkFileNames); const chunksDirUrl = new URL(chunkPath + '/', _buildConfig.server); await fs.promises.rm(chunksDirUrl, { recursive: true, force: true }); diff --git a/packages/integrations/image/src/index.ts b/packages/integrations/image/src/index.ts index 05fcdad58685..323296ea0227 100644 --- a/packages/integrations/image/src/index.ts +++ b/packages/integrations/image/src/index.ts @@ -147,7 +147,7 @@ export default function integration(options: IntegrationOptions = {}): AstroInte // For the Squoosh service, copy all wasm files to dist/chunks. // Because the default loader is dynamically imported (above), // Vite will bundle squoosh to dist/chunks and expect to find the wasm files there - await copyWasmFiles(new URL(`./${_buildConfig.assets}/chunks`, dir)); + await copyWasmFiles(new URL(`./chunks/`, dir)); } if (loader && 'transform' in loader && staticImages.size > 0) { @@ -167,7 +167,7 @@ export default function integration(options: IntegrationOptions = {}): AstroInte }, 'astro:build:ssr': async () => { if (resolvedOptions.serviceEntryPoint === '@astrojs/image/squoosh') { - await copyWasmFiles(new URL(`./${_buildConfig.assets}/chunks/`, _buildConfig.server)); + await copyWasmFiles(new URL(`./chunks/`, _buildConfig.server)); } }, }, diff --git a/packages/integrations/netlify/src/integration-edge-functions.ts b/packages/integrations/netlify/src/integration-edge-functions.ts index c87eba55e4c9..a05f8f3a0fff 100644 --- a/packages/integrations/netlify/src/integration-edge-functions.ts +++ b/packages/integrations/netlify/src/integration-edge-functions.ts @@ -81,7 +81,7 @@ async function createEdgeManifest(routes: RouteData[], entryFile: string, dir: U await fs.promises.writeFile(manifestURL, _manifest, 'utf-8'); } -async function bundleServerEntry({ serverEntry, server, assets }: BuildConfig, vite: any) { +async function bundleServerEntry({ serverEntry, server }: BuildConfig, vite: any) { const entryUrl = new URL(serverEntry, server); const pth = fileURLToPath(entryUrl); await esbuild.build({ @@ -101,7 +101,7 @@ async function bundleServerEntry({ serverEntry, server, assets }: BuildConfig, v // Remove chunks, if they exist. Since we have bundled via esbuild these chunks are trash. try { const chunkFileNames = - vite?.build?.rollupOptions?.output?.chunkFileNames ?? `${assets}/chunks/chunk.[hash].mjs`; + vite?.build?.rollupOptions?.output?.chunkFileNames ?? `chunks/chunk.[hash].mjs`; const chunkPath = npath.dirname(chunkFileNames); const chunksDirUrl = new URL(chunkPath + '/', server); await fs.promises.rm(chunksDirUrl, { recursive: true, force: true });