Skip to content

feat: support api.resolve hook#3785

Merged
chenjiahan merged 2 commits intomainfrom
resolve-hook
Oct 21, 2024
Merged

feat: support api.resolve hook#3785
chenjiahan merged 2 commits intomainfrom
resolve-hook

Conversation

@9aoy
Copy link
Copy Markdown
Contributor

@9aoy 9aoy commented Oct 21, 2024

Summary

The api.resolve hook can be used to intercept and modify module request information before module resolution begins.
The same as Rspack's normalModuleFactory.hooks.resolve hook.

import type { RsbuildPlugin } from '@rsbuild/core';

export default (): RsbuildPlugin => ({
  name: 'plugin-foo',

  setup: (api) => {
    api.resolve(({ resolveData }) => {
      if (resolveData.request === './a.js') {
        resolveData.request = './b.js';
      }
   });
  },
});

Related Links

Checklist

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

@netlify
Copy link
Copy Markdown

netlify bot commented Oct 21, 2024

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 6fed19b
🔍 Latest deploy log https://app.netlify.com/sites/rsbuild/deploys/67165e4b2e37270008012891
😎 Deploy Preview https://deploy-preview-3785--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: 73 (no change from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (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 site configuration.

@chenjiahan chenjiahan enabled auto-merge (squash) October 21, 2024 14:01
@chenjiahan chenjiahan merged commit 75c7e92 into main Oct 21, 2024
@chenjiahan chenjiahan deleted the resolve-hook branch October 21, 2024 14:06
@chenjiahan chenjiahan mentioned this pull request Oct 22, 2024
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