fix: bundle CSS from external dependencies instead of externalizing#981
Open
compass-vin wants to merge 1 commit into
Open
fix: bundle CSS from external dependencies instead of externalizing#981compass-vin wants to merge 1 commit into
compass-vin wants to merge 1 commit into
Conversation
CSS files imported via JS/TS (e.g. `import 'pkg/style.css'` or `import style from 'pkg/style.css?inline'`) from production dependencies were being marked as external by the deps plugin, preventing the CSS plugin from processing them into the output bundle. Fixes rolldown#959 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
✅ Deploy Preview for tsdown-main ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
tsdown
create-tsdown
@tsdown/css
@tsdown/exe
tsdown-migrate
commit: |
Author
|
Tested fix is here: https://stackblitz.com/edit/github-2dddpu9g-22k8rjck?file=src%2Findex.ts |
Author
|
@sxzz Hey, it's my first time contributing to this project so apologies if I'm missing a step. Is there anything I need to do to get this reviewed? Thanks for all the work on this btw, I love this library. |
3 tasks
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.
Summary
Fixes #959
CSS files imported via JS/TS from production dependencies (listed in
dependencies,peerDependencies, oroptionalDependencies) were being marked as external by the deps plugin, which prevented the CSS plugin from processing them into the output bundle.This affected both regular CSS imports and
?inlineCSS imports:import 'jodit/es2021/jodit.css'— CSS not included in outputstyle.cssimport style from 'jodit/es2021/jodit.css?inline'— CSS not inlined as stringRoot cause:
externalStrategy()insrc/features/deps.tschecked if an import's package name matched a production dependency and externalized it unconditionally. CSS files need to be bundled so the CSS plugin can process them.Fix: Added a guard in
externalStrategy()that returns'no-external'for CSS file imports (.css,.scss,.sass,.less,.styl,.stylus), stripping any query string (e.g.?inline) before testing. This runs after thealwaysBundlecheck but before the dependency externalization checks.Test plan
import?inlineimport🤖 Generated with Claude Code