Skip to content

feat: enhance browser error log for undefined process.env#6401

Merged
chenjiahan merged 2 commits intomainfrom
process_undefined_tip_1022
Oct 22, 2025
Merged

feat: enhance browser error log for undefined process.env#6401
chenjiahan merged 2 commits intomainfrom
process_undefined_tip_1022

Conversation

@chenjiahan
Copy link
Member

Summary

Add helpful guidance when users encounter process is not defined errors in the browser. The enhanced log explains how to properly use environment variables and suggests polyfill options.

Before

Screenshot 2025-10-22 at 15 03 33

After

Screenshot 2025-10-22 at 15 22 27

Checklist

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

Copilot AI review requested due to automatic review settings October 22, 2025 07:27
@netlify
Copy link

netlify bot commented Oct 22, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit c4c76ec
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/68f888e4d422ea00087df813
😎 Deploy Preview https://deploy-preview-6401--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 11 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.

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 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 defined errors 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.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@chenjiahan chenjiahan merged commit 0c1113c into main Oct 22, 2025
11 checks passed
@chenjiahan chenjiahan deleted the process_undefined_tip_1022 branch October 22, 2025 07:47
@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.

1 participant