From cef5945882899513f52e08990f25dbae1f9e787f Mon Sep 17 00:00:00 2001
From: PortalCube <35104213+PortalCube@users.noreply.github.com>
Date: Fri, 18 Apr 2025 17:28:37 +0900
Subject: [PATCH 1/2] fix: use `group.type` for CSS entrypoint check

---
 packages/wxt/src/core/builders/vite/index.ts | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/packages/wxt/src/core/builders/vite/index.ts b/packages/wxt/src/core/builders/vite/index.ts
index 2a99154d9..c15b5aeb2 100644
--- a/packages/wxt/src/core/builders/vite/index.ts
+++ b/packages/wxt/src/core/builders/vite/index.ts
@@ -308,7 +308,10 @@ export async function createViteBuilder(
     async build(group) {
       let entryConfig;
       if (Array.isArray(group)) entryConfig = getMultiPageConfig(group);
-      else if (group.inputPath.endsWith('.css'))
+      else if (
+        group.type === 'content-script-style' ||
+        group.type === 'unlisted-style'
+      )
         entryConfig = getCssConfig(group);
       else entryConfig = getLibModeConfig(group);
 

From 4dbaec22a4c4dff45be86aa2f4316cbde7a35702 Mon Sep 17 00:00:00 2001
From: PortalCube <35104213+PortalCube@users.noreply.github.com>
Date: Fri, 18 Apr 2025 17:46:57 +0900
Subject: [PATCH 2/2] test: add e2e test for css entrypoint

---
 .../wxt/e2e/tests/output-structure.test.ts    | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)

diff --git a/packages/wxt/e2e/tests/output-structure.test.ts b/packages/wxt/e2e/tests/output-structure.test.ts
index 4145eaabe..b1a621c7d 100644
--- a/packages/wxt/e2e/tests/output-structure.test.ts
+++ b/packages/wxt/e2e/tests/output-structure.test.ts
@@ -220,6 +220,77 @@ describe('Output Directory Structure', () => {
     expect(await project.fileExists('.output/chrome-mv3/unlisted.js'));
   });
 
+  it('should support CSS entrypoints', async () => {
+    const project = new TestProject();
+
+    project.addFile(
+      'entrypoints/plain-one.css',
+      `body {
+        font: 100% Helvetica, sans-serif;
+        color: #333;
+      }`,
+    );
+
+    project.addFile(
+      'entrypoints/plain-two.content.css',
+      `body {
+        font: 100% Helvetica, sans-serif;
+        color: #333;
+      }`,
+    );
+
+    project.addFile(
+      'entrypoints/sass-one.scss',
+      `$font-stack: Helvetica, sans-serif;
+      $primary-color: #333;
+
+      body {
+        font: 100% $font-stack;
+        color: $primary-color;
+      }`,
+    );
+
+    project.addFile(
+      'entrypoints/sass-two.content.scss',
+      `$font-stack: Helvetica, sans-serif;
+      $primary-color: #333;
+
+      body {
+        font: 100% $font-stack;
+        color: $primary-color;
+      }`,
+    );
+
+    await project.build();
+
+    expect(await project.serializeOutput(['.output/chrome-mv3/manifest.json']))
+      .toMatchInlineSnapshot(`
+        ".output/chrome-mv3/assets/plain-one.css
+        ----------------------------------------
+        body{font:100% Helvetica,sans-serif;color:#333}
+
+        ================================================================================
+        .output/chrome-mv3/assets/sass-one.css
+        ----------------------------------------
+        body{font:100% Helvetica,sans-serif;color:#333}
+
+        ================================================================================
+        .output/chrome-mv3/content-scripts/plain-two.css
+        ----------------------------------------
+        body{font:100% Helvetica,sans-serif;color:#333}
+
+        ================================================================================
+        .output/chrome-mv3/content-scripts/sass-two.css
+        ----------------------------------------
+        body{font:100% Helvetica,sans-serif;color:#333}
+
+        ================================================================================
+        .output/chrome-mv3/manifest.json
+        ----------------------------------------
+        <contents-ignored>"
+      `);
+  });
+
   it("should output to a custom directory when overriding 'outDir'", async () => {
     const project = new TestProject();
     project.addFile('entrypoints/unlisted.html', '<html></html>');