Skip to content
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

fix: shared Rsbuild plugins should run only once #552

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

chenjiahan
Copy link
Member

Summary

I found this issue when testing rsbuild-plugin-publint.

In Rsbuild, shared plugins will run only once. Take rsbuild-plugin-publint as an example, it uses api.onAfterBuild to trigger the linting, and this should only be triggered once per build, otherwise it will result in duplicate lint output.

// rsbuild.config.ts
export default {
  // this is a shared plugin
  plugins: [publintPlugin],
  environments: {
    client: {
      plugins: [clientOnlyPlugin],
    },
    server: {
      plugins: [serverOnlyPlugin],
    },
  },
};

Currently Rslib does not align with this behavior, the shared plugins are registered multiple times. After this PR, Rslib will be aligned with Rsbuild.

Checklist

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

Copy link

netlify bot commented Dec 12, 2024

Deploy Preview for rslib ready!

Name Link
🔨 Latest commit fa5ea86
🔍 Latest deploy log https://app.netlify.com/sites/rslib/deploys/675ac208e77e54000810c78f
😎 Deploy Preview https://deploy-preview-552--rslib.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

Copy link

codspeed-hq bot commented Dec 12, 2024

CodSpeed Performance Report

Merging #552 will not alter performance

Comparing shared_plugin_1212 (1c7c718) with main (aa4c5f3)

Summary

✅ 5 untouched benchmarks

@Timeless0911 Timeless0911 merged commit 5316efc into main Dec 13, 2024
18 checks passed
@Timeless0911 Timeless0911 deleted the shared_plugin_1212 branch December 13, 2024 05:08
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.

2 participants