diff --git a/chevron-down.svg b/chevron-down.svg
new file mode 100644
index 0000000000..f680446895
--- /dev/null
+++ b/chevron-down.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/bundler/linker_context/computeChunks.zig b/src/bundler/linker_context/computeChunks.zig
index 6aef6b0f0c..f0c8d7de91 100644
--- a/src/bundler/linker_context/computeChunks.zig
+++ b/src/bundler/linker_context/computeChunks.zig
@@ -195,6 +195,10 @@ pub noinline fn computeChunks(
const entry_bits: *const AutoBitSet = &file_entry_bits[source_index.get()];
if (css_reprs[source_index.get()] != null) continue;
+ // Check if this file has a JavaScript-like loader
+ const loader = loaders[source_index.get()];
+ if (!loader.isJavaScriptLike()) continue;
+
if (this.graph.code_splitting) {
const js_chunk_key = try temp_allocator.dupe(u8, entry_bits.bytes(this.graph.entry_points.len));
var js_chunk_entry = try js_chunks.getOrPut(js_chunk_key);
diff --git a/style.css b/style.css
new file mode 100644
index 0000000000..652999399f
--- /dev/null
+++ b/style.css
@@ -0,0 +1,3 @@
+select {
+ background-image: url("./chevron-down.svg");
+}
diff --git a/test/bundler/bundler_edgecase.test.ts b/test/bundler/bundler_edgecase.test.ts
index 07a340653e..f02d5b6a20 100644
--- a/test/bundler/bundler_edgecase.test.ts
+++ b/test/bundler/bundler_edgecase.test.ts
@@ -2358,3 +2358,27 @@ for (const backend of ["api", "cli"] as const) {
});
});
}
+
+// Fixes #20278
+itBundled("edgecase/SvgEntryPointAndDataUrl", {
+ files: {
+ "/style.css": `select {
+ background-image: url("./chevron-down.svg");
+}`,
+ "/chevron-down.svg": ``,
+ },
+ entryPoints: ["/style.css", "/chevron-down.svg"],
+ outdir: "/out",
+ onAfterBundle(api) {
+ // The CSS should inline the SVG as a data URL
+ api.expectFile("/out/style.css").toContain("background-image: url(");
+ api.expectFile("/out/style.css").toContain("data:image/svg+xml");
+
+ // The SVG should also be emitted as a separate file
+ api
+ .expectFile("/out/chevron-down.svg")
+ .toEqual(
+ ``,
+ );
+ },
+});