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

feat: support add plugins for specified environment #2986

Merged
merged 10 commits into from
Jul 23, 2024

Conversation

9aoy
Copy link
Collaborator

@9aoy 9aoy commented Jul 22, 2024

Summary

Support add plugins for specified environment.

For example, enable the react plugin only in the web environment:

import { pluginReact } from '@rsbuild/plugin-react';

export default {
  environments: {
    web: {
      output: {
        target: 'web',
      },
      plugins: [pluginReact()],
    },
    node: {
      output: {
        target: 'node',
      },
    },
  },
};

TODO: Some plugins do not yet support single-environment registration because they use api.modifyRsbuildConfig hook to modify the global configuration.

Related Links

#2620

Checklist

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

Copy link

netlify bot commented Jul 22, 2024

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit e8418ba
🔍 Latest deploy log https://app.netlify.com/sites/rsbuild/deploys/669f50ca7b73110008d3dcde
😎 Deploy Preview https://deploy-preview-2986--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: 75 (🔴 down 12 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.

@9aoy 9aoy requested a review from chenjiahan July 22, 2024 08:50
packages/core/src/initHooks.ts Outdated Show resolved Hide resolved
packages/core/src/initHooks.ts Outdated Show resolved Hide resolved
packages/core/src/types/plugin.ts Outdated Show resolved Hide resolved
website/docs/zh/guide/advanced/environments.mdx Outdated Show resolved Hide resolved
website/docs/zh/guide/advanced/environments.mdx Outdated Show resolved Hide resolved
website/docs/en/guide/advanced/environments.mdx Outdated Show resolved Hide resolved
website/docs/en/guide/advanced/environments.mdx Outdated Show resolved Hide resolved
9aoy and others added 6 commits July 22, 2024 18:45
Co-authored-by: neverland <jait.chen@foxmail.com>
Co-authored-by: neverland <jait.chen@foxmail.com>
Co-authored-by: neverland <jait.chen@foxmail.com>
Co-authored-by: neverland <jait.chen@foxmail.com>
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.

Awesome 🎉

@chenjiahan chenjiahan enabled auto-merge (squash) July 23, 2024 06:45
@chenjiahan chenjiahan merged commit 2b249da into web-infra-dev:main Jul 23, 2024
10 checks passed
easy1090 added a commit that referenced this pull request Jul 23, 2024
fix: rsdoctor plugin

fix: rsdoctor plugin

feat: support add plugins for specified environment (#2986)

Co-authored-by: neverland <jait.chen@foxmail.com>

Update packages/core/src/plugins/rsdoctor.ts

Co-authored-by: neverland <chenjiahan.jait@bytedance.com>

Update packages/core/src/plugins/rsdoctor.ts

Co-authored-by: neverland <chenjiahan.jait@bytedance.com>

Update packages/core/src/plugins/rsdoctor.ts

Co-authored-by: neverland <chenjiahan.jait@bytedance.com>

fix: modify the criteria for verifying the Rsdoctor plugin.
easy1090 added a commit that referenced this pull request Jul 23, 2024
fix: rsdoctor plugin

fix: rsdoctor plugin

feat: support add plugins for specified environment (#2986)

Co-authored-by: neverland <jait.chen@foxmail.com>

Update packages/core/src/plugins/rsdoctor.ts

Co-authored-by: neverland <chenjiahan.jait@bytedance.com>

Update packages/core/src/plugins/rsdoctor.ts

Co-authored-by: neverland <chenjiahan.jait@bytedance.com>

Update packages/core/src/plugins/rsdoctor.ts

Co-authored-by: neverland <chenjiahan.jait@bytedance.com>

fix: modify the criteria for verifying the Rsdoctor plugin.
easy1090 added a commit that referenced this pull request Jul 23, 2024
fix: rsdoctor plugin

fix: rsdoctor plugin

feat: support add plugins for specified environment (#2986)

Co-authored-by: neverland <jait.chen@foxmail.com>

Update packages/core/src/plugins/rsdoctor.ts

Co-authored-by: neverland <chenjiahan.jait@bytedance.com>

Update packages/core/src/plugins/rsdoctor.ts

Co-authored-by: neverland <chenjiahan.jait@bytedance.com>

Update packages/core/src/plugins/rsdoctor.ts

Co-authored-by: neverland <chenjiahan.jait@bytedance.com>

fix: modify the criteria for verifying the Rsdoctor plugin.

fix: modify the criteria for verifying the Rsdoctor plugin.
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