Skip to content

Conversation

@inottn
Copy link
Collaborator

@inottn inottn commented Dec 27, 2025

Summary

Generate css file for universal target and update test cases.

Related

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings December 27, 2025 17:42
@netlify
Copy link

netlify bot commented Dec 27, 2025

Deploy Preview for rspack canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit fdfdf54
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/69501a990f831d0008add9c0

@github-actions github-actions bot added the release: bug fix release: bug related release(mr only) label Dec 27, 2025
Copy link
Contributor

Copilot AI left a 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 null and false document 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-hq
Copy link

codspeed-hq bot commented Dec 27, 2025

CodSpeed Performance Report

Merging #12570 will not alter performance

Comparing inottn:fix/universal (fdfdf54) with main (3e8ba27)

Summary

✅ 16 untouched
⏩ 1 skipped1

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

Copy link
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you ❤️

@chenjiahan chenjiahan changed the title fix: generate css file for universal target fix: generate CSS file for universal target Dec 28, 2025
@chenjiahan chenjiahan merged commit 457add6 into web-infra-dev:main Dec 28, 2025
66 checks passed
@inottn inottn deleted the fix/universal branch December 29, 2025 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: bug fix release: bug related release(mr only)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants