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
5 changes: 5 additions & 0 deletions .changeset/puny-yaks-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes a regression introduced in Astro v5.14.7 that caused `?url` imports to not work correctly. This release reverts [#14142](https://github.com/withastro/astro/pull/14142).
14 changes: 3 additions & 11 deletions packages/astro/src/core/build/plugins/plugin-css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,7 @@ function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] {
// and that's okay. We can use Rollup's default chunk strategy instead as these CSS
// are outside of the SSR build scope, which no dedupe is needed.
if (options.target === 'client') {
// Find the chunkId for this CSS module in the server build.
// If it exists, we can use it to ensure the client build matches the server
// build and doesn't create a duplicate chunk.
return internals.cssModuleToChunkIdMap.get(id);
return internals.cssModuleToChunkIdMap.get(id)!;
}

const ctx = { getModuleInfo: meta.getModuleInfo };
Expand All @@ -96,7 +93,6 @@ function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] {
return chunkId;
}
}

const chunkId = createNameForParentPages(id, meta);
internals.cssModuleToChunkIdMap.set(id, chunkId);
return chunkId;
Expand Down Expand Up @@ -234,12 +230,8 @@ function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] {
sheetAddedToPage = true;
}

const wasInlined = toBeInlined && sheetAddedToPage;
const isOrphaned = !sheetAddedToPage;
if (wasInlined || isOrphaned) {
// wasInlined : CSS is already added to all used pages
// isOrphaned : CSS is already used in a merged chunk
// we can delete it from the bundle
if (toBeInlined && sheetAddedToPage) {
// CSS is already added to all used pages, we can delete it from the bundle
// and make sure no chunks reference it via `importedCss` (for Vite preloading)
// to avoid duplicate CSS.
delete bundle[id];
Expand Down
81 changes: 0 additions & 81 deletions packages/astro/test/css-deduplication.test.js

This file was deleted.

10 changes: 0 additions & 10 deletions packages/astro/test/fixtures/css-deduplication/astro.config.mjs

This file was deleted.

13 changes: 0 additions & 13 deletions packages/astro/test/fixtures/css-deduplication/package.json

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions packages/astro/test/fixtures/css-deduplication/tsconfig.json

This file was deleted.

21 changes: 0 additions & 21 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading