-
-
Notifications
You must be signed in to change notification settings - Fork 757
fix: generate CSS file for universal target #12570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for rspack canceled.Built without sensitive environment variables
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes CSS file generation for universal targets (e.g., ["web", "node"]). Previously, CSS files were not generated when using a universal target because the logic treated null document properties (result of merging web and node targets) the same as false. The fix ensures CSS files are generated for universal targets by only suppressing CSS generation when document is explicitly false.
Key Changes:
- Updated CSS generator defaults logic to differentiate between
nullandfalsedocument properties - Added support for array targets in test runner selection
- Refactored CSS generator options into a reusable function to reduce code duplication
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/rspack/src/config/target.ts | Exports TargetProperties type for use in defaults configuration |
| packages/rspack/src/config/defaults.ts | Extracts applyCssGeneratorOptionsDefaults function and updates logic to generate CSS for universal targets (when document is null) |
| packages/rspack-test-tools/src/case/runner.ts | Adds isWebTarget helper to properly detect web targets in both string and array formats |
| tests/rspack-test/configCases/css/universal/rspack.config.js | Changes target from "web" to ["web", "node"] to test universal target |
| tests/rspack-test/configCases/css/universal/test.config.js | Uncomments CSS link creation code to test CSS file generation for universal target |
| tests/rspack-test/configCases/asset-modules/bytes/test.config.js | Updates CSS bundle reference to handle multi-compiler test with different targets (bundle0.css for web, bundle2.css for universal) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CodSpeed Performance ReportMerging #12570 will not alter performanceComparing Summary
Footnotes
|
chenjiahan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you ❤️
Summary
Generate css file for universal target and update test cases.
Related
Checklist