Fix CSS not being inlined in dashboard HTML#51
Open
stevelandeydescript wants to merge 2 commits intomainfrom
Open
Fix CSS not being inlined in dashboard HTML#51stevelandeydescript wants to merge 2 commits intomainfrom
stevelandeydescript wants to merge 2 commits intomainfrom
Conversation
tsdown/rolldown's native CSS handling was intercepting .css imports before our inlineRawFiles plugin could run, extracting them into separate files and exporting empty objects. The dashboard's styles.css was silently dropped from the HTML output, leaving all tabs, provider pills, and badge styling unstyled. Fixed by adding a resolveId hook that redirects .css imports to a virtual .cssraw extension, bypassing rolldown's CSS extraction while still reading and inlining the file content via the load hook. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Windows paths lose drive letter in URL resolution
- Replaced manual file:// URL construction with path.resolve(dirname(importer), source), which correctly handles Windows drive letters and avoids URL encoding issues.
Or push these changes by commenting:
@cursor push e733d422cd
Preview (e733d422cd)
diff --git a/tsdown.config.ts b/tsdown.config.ts
--- a/tsdown.config.ts
+++ b/tsdown.config.ts
@@ -1,4 +1,5 @@
import { readFileSync } from 'node:fs';
+import { dirname, resolve } from 'node:path';
import { defineConfig } from 'tsdown';
import type { Plugin } from 'rolldown';
@@ -9,7 +10,7 @@
// Redirect .css imports to a virtual .cssraw ID so rolldown's
// native CSS handling doesn't extract them into separate files.
if (source.endsWith('.css') && importer) {
- const resolved = new URL(source, 'file://' + importer).pathname;
+ const resolved = resolve(dirname(importer), source);
return { id: resolved + '.cssraw' };
}
},You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 2f6bdec. Configure here.
new URL(source, 'file://' + importer) produces a malformed URL on Windows where the drive letter becomes the hostname. Use path.resolve(dirname(importer), source) which handles all platforms. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
rzeng95
approved these changes
May 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


tsdown/rolldown's native CSS handling was intercepting .css imports before our inlineRawFiles plugin could run, extracting them into separate files and exporting empty objects. The dashboard's styles.css was silently dropped from the HTML output, leaving all tabs, provider pills, and badge styling unstyled.
Fixed by adding a resolveId hook that redirects .css imports to a virtual .cssraw extension, bypassing rolldown's CSS extraction while still reading and inlining the file content via the load hook.
Note
Low Risk
Low risk build-config change limited to how
.cssfiles are resolved/loaded for bundling; main risk is unexpected handling of CSS import resolution paths.Overview
Fixes CSS imports being dropped/extracted during bundling by updating
inlineRawFilesintsdown.config.ts.The plugin now intercepts
.cssimports inresolveIdand rewrites them to a virtual.cssrawpath, thenloadreads the original file and exports its contents as a string so CSS is inlined instead of handled by rolldown’s native CSS pipeline.Reviewed by Cursor Bugbot for commit 2f17886. Bugbot is set up for automated code reviews on this repo. Configure here.