Skip to content

feat: add new plugin API to process assets#2966

Merged
chenjiahan merged 1 commit intomainfrom
process_assets_api_0720
Jul 20, 2024
Merged

feat: add new plugin API to process assets#2966
chenjiahan merged 1 commit intomainfrom
process_assets_api_0720

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

@chenjiahan chenjiahan commented Jul 20, 2024

Summary

Add new plugin API to process assets, the functionality is equivalent to Rspack's compilation.hooks.processAssets. This hook is very useful, so we add it to Rsbuild's plugin API.

const myPlugin: RsbuildPlugin = {
  name: 'my-plugin',
  setup(api) {
    api.processAssets({ stage: 'summarize' }, ({ assets, compilation }) => {
      for (const key of Object.keys(assets)) {
        if (key.endsWith('.css')) {
          compilation.deleteAsset(key);
        }
      }
    });
  },
};

Related Links

https://www.rspack.dev/api/plugin-api/compilation-hooks#processassets

Checklist

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

@netlify
Copy link
Copy Markdown

netlify Bot commented Jul 20, 2024

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 98b2032
🔍 Latest deploy log https://app.netlify.com/sites/rsbuild/deploys/669ba6c92bb9d100083d3520
😎 Deploy Preview https://deploy-preview-2966--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: 76 (no change from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (no change from production)
PWA: -
View the detailed breakdown and full score reports

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

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