feat: enhance browser error log for undefined process.env#6401
feat: enhance browser error log for undefined process.env#6401chenjiahan merged 2 commits intomainfrom
Conversation
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull Request Overview
This PR enhances error messaging for browser-side process is not defined errors by providing actionable guidance on how to properly use environment variables in a browser context.
- Adds intelligent error log enhancement that detects
process is not definederrors and appends helpful instructions - Includes test coverage for the new browser error enhancement functionality
- Fixes minor formatting issue in plugin hint messages
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/core/src/server/browserLogs.ts | Implements error detection and enhancement logic for process is not defined errors |
| packages/core/src/helpers/format.ts | Adds newline to plugin recommendation message formatting |
| e2e/cases/diagnostic/process-undefined/src/index.js | Adds test fixture that triggers process undefined error |
| e2e/cases/diagnostic/process-undefined/index.test.ts | Adds E2E test verifying enhanced error message appears |
Comments suppressed due to low confidence (1)
packages/core/src/server/browserLogs.ts:1
- [nitpick] The multi-line string uses inconsistent indentation with hardcoded spaces. Consider extracting this message to a constant or using template literals with proper indentation for better maintainability.
import path from 'node:path';
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Summary
Add helpful guidance when users encounter
process is not definederrors in the browser. The enhanced log explains how to properly use environment variables and suggests polyfill options.Before
After
Checklist