Skip to content

docs(env-vars): add section for accessing env mode in client code#6446

Merged
chenjiahan merged 1 commit intomainfrom
env_mode_client_1027
Oct 27, 2025
Merged

docs(env-vars): add section for accessing env mode in client code#6446
chenjiahan merged 1 commit intomainfrom
env_mode_client_1027

Conversation

@chenjiahan
Copy link
Member

Summary

Explain how to use source.define to make env mode available in client code

Related Links

resolve #6432

Checklist

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

Copilot AI review requested due to automatic review settings October 27, 2025 02:52
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 adds documentation explaining how to access the Rsbuild environment mode (envMode) in client-side code. The documentation has been added to both English and Chinese versions of the env-vars guide.

  • Adds a new "Accessing in client code" section explaining that envMode is not injected by default
  • Provides a code example showing how to use source.define to make envMode available in client code
  • Demonstrates usage of the defined global identifier in client code

Reviewed Changes

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

File Description
website/docs/zh/guide/advanced/env-vars.mdx Adds Chinese documentation for accessing env mode in client code
website/docs/en/guide/advanced/env-vars.mdx Adds English documentation for accessing env mode in client code

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

@netlify
Copy link

netlify bot commented Oct 27, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit d41602c
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/68fede6c0335b80008c99bf7
😎 Deploy Preview https://deploy-preview-6446--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: 70 (🟢 up 7 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.

@chenjiahan chenjiahan merged commit 17bb33c into main Oct 27, 2025
12 checks passed
@chenjiahan chenjiahan deleted the env_mode_client_1027 branch October 27, 2025 02:55
@chenjiahan chenjiahan mentioned this pull request Oct 30, 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.

[Feature]: Can we provide a convenient way to get envMode in JS?

1 participant

Comments