Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/astro/src/core/build/static-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ async function buildEnvironments(opts: StaticBuildOptions, internals: BuildInter
output: {
entryFileNames: `${PRERENDER_ENTRY_FILENAME_PREFIX}.[hash].mjs`,
format: 'esm',
...viteConfig.environments?.prerender?.build?.rollupOptions?.output,
},
},
ssr: true,
Expand Down Expand Up @@ -245,6 +246,11 @@ async function buildEnvironments(opts: StaticBuildOptions, internals: BuildInter
ssr: {
build: {
outDir: fileURLToPath(getServerOutputDirectory(settings)),
rollupOptions: {
output: {
...viteConfig.environments?.ssr?.build?.rollupOptions?.output
}
}
},
},
},
Expand Down
29 changes: 17 additions & 12 deletions packages/astro/test/astro-css-bundling.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,23 @@ describe('CSS Bundling', function () {
root: './fixtures/astro-css-bundling/',

// test suite was authored when inlineStylesheets defaulted to never
build: { inlineStylesheets: 'never' },
build: {
inlineStylesheets: 'never',
assets: 'assets',
},

vite: {
build: {
rollupOptions: {
output: {
assetFileNames: 'assets/[name][extname]',
entryFileNames: '[name].js',
},
},
},
environments: {
prerender: {
build: {
rollupOptions: {
output: {
assetFileNames: 'assets/[name][extname]',
}
}
}
}
}
},
});
await fixture.build({ mode: 'production' });
Expand All @@ -106,10 +112,9 @@ describe('CSS Bundling', function () {
assert.doesNotMatch(firstFound, /[a-z]+\.[\da-z]{8}\.css/);
});

it('there are 2 index named CSS files', async () => {
it('there are 4 css files (3 pages, one shared component)', async () => {
const dir = await fixture.readdir('/assets');
const indexNamedFiles = dir.filter((name) => name.startsWith('index'));
assert.equal(indexNamedFiles.length, 2);
assert.equal(dir.length, 4);
});
});
});
Loading