Skip to content

fix(type): make the PostCSS plugin type loose #5364

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

Merged
merged 1 commit into from
Jun 5, 2025
Merged

Conversation

chenjiahan
Copy link
Member

Summary

When user passes a PostCSS plugin to tools.postcss config, the plugin may depend on a different version of PostCSS, which can cause type errors. This PR loosens the PostCSS plugin type to resolve type issue.

Related Links

Fix ecosystem CI: https://github.com/rspack-contrib/rsbuild-ecosystem-ci/actions/runs/15458968100/job/43516378827

Checklist

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

@Copilot Copilot AI review requested due to automatic review settings June 5, 2025 06:30
Copy link

netlify bot commented Jun 5, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 7292559
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/6841398fde2b3b0009adc8c2
😎 Deploy Preview https://deploy-preview-5364--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 84 (🟢 up 12 from production)
Accessibility: 97 (no change from production)
Best Practices: 92 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

@Copilot 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 loosens the PostCSS plugin type to avoid type errors when users supply plugins built against different PostCSS versions.

  • Changed PostCSSOptions.plugins to accept unknown[] instead of a strict plugin type
  • Updated ToolsPostCSSLoaderConfig.addPlugins to use unknown types
  • Adapted CSS plugin loader to store and map plugins as unknown, adding runtime casts

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
packages/core/src/types/thirdParty.ts Made plugins property accept unknown[]
packages/core/src/types/config.ts Loosened addPlugins signature to unknown types
packages/core/src/plugins/css.ts Updated extraPlugins array and plugin-mapping casts

@chenjiahan chenjiahan merged commit 8772871 into main Jun 5, 2025
11 of 12 checks passed
@chenjiahan chenjiahan deleted the postcss_type_0605 branch June 5, 2025 06:39
chenjiahan added a commit that referenced this pull request Jun 5, 2025
@chenjiahan chenjiahan mentioned this pull request Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant