Skip to content

Conversation

@chenjiahan
Copy link
Member

Summary

Currently, tools.rspack can access the current environment's context, but in some cases it may need to access all environment contexts.

This PR exposes environments in tools.rspack and tools.bundlerChain:

  • Add environments parameter to chain utils functions
  • Update documentation to include environments context

Checklist

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

Copilot AI review requested due to automatic review settings November 11, 2025 14:52
@netlify
Copy link

netlify bot commented Nov 11, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 8c085fb
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/69134d97d3a70d000876b708
😎 Deploy Preview https://deploy-preview-6555--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: 55 (🔴 down 13 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (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.

Copilot finished reviewing on behalf of chenjiahan November 11, 2025 14:55
Copy link
Contributor

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 exposes the environments parameter in tools.rspack and tools.bundlerChain configuration functions, allowing users to access context information for all environments, not just the current one.

  • Adds environments: Record<string, EnvironmentContext> to ModifyChainUtils type and related utilities
  • Updates documentation in English and Chinese for both tools.rspack and tools.bundlerChain
  • Adds JSDoc comments to various hook type definitions for consistency

Reviewed Changes

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

Show a summary per file
File Description
packages/core/src/types/hooks.ts Adds environments field to ModifyChainUtils type and JSDoc comments to multiple hook parameter types for documentation consistency
packages/core/src/types/context.ts Updates comment for environments field in InternalContext to be more concise
packages/core/src/provider/rspackConfig.ts Updates getChainUtils to accept and include environments parameter; refactors generateRspackConfig to use environmentName parameter name for clarity
packages/core/src/provider/initConfigs.ts Refactors parameter name from environment to environmentName in map function for improved clarity
packages/compat/webpack/src/webpackConfig.ts Updates webpack provider's getChainUtils to accept and pass through environments parameter
website/docs/en/config/tools/rspack.mdx Adds documentation for new environments parameter and improves wording for existing environment parameter description
website/docs/en/config/tools/bundler-chain.mdx Adds documentation for new environments parameter and improves wording for existing environment parameter description
website/docs/zh/config/tools/rspack.mdx Adds Chinese documentation for new environments parameter
website/docs/zh/config/tools/bundler-chain.mdx Adds Chinese documentation for new environments parameter
website/docs/en/shared/onBeforeStartDevServer.mdx Simplifies comment description for environments parameter
website/docs/zh/shared/onBeforeStartDevServer.mdx Simplifies comment description for environments parameter

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chenjiahan chenjiahan merged commit 234ed78 into main Nov 12, 2025
18 checks passed
@chenjiahan chenjiahan deleted the environments_param_1111 branch November 12, 2025 02:37
@chenjiahan chenjiahan mentioned this pull request Nov 12, 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.

2 participants