Skip to content

Conversation

@adhami3310
Copy link
Member

No description provided.

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 17, 2025

CodSpeed Performance Report

Merging #5906 will create unknown performance changes

Comparing enable-exp-hmr (5e21862) with main (0f8c19d)

Summary

⚠️ No benchmarks were detected in both the base of the PR and the PR.
Please ensure that your benchmarks are correctly instrumented with CodSpeed.

Check out the benchmarks creation guide

⏩ 8 skipped1

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Summary

This PR exposes two new Vite configuration options through environment variables:

  • VITE_EXPERIMENTAL_HMR (defaults to True): enables Rolldown's experimental hot module replacement
  • VITE_SOURCEMAP (defaults to False): controls sourcemap generation with support for boolean and string literal values (False, True, "inline", "hidden")

The implementation includes:

  • New Literal type interpretation logic in the environment variable system to support union types with mixed bool/string literals
  • Updated Vite config template to output the experimental HMR and sourcemap settings
  • Proper type hints and documentation throughout

Confidence Score: 5/5

  • This PR is safe to merge with no issues found
  • The changes are well-structured and properly implemented. The Literal type interpretation logic correctly handles all value types (string, bool, int). The template correctly converts Python values to JavaScript syntax. All changes are additive with sensible defaults that maintain backward compatibility.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
reflex/compiler/templates.py 5/5 Added two new parameters to vite_config_template function (experimental_hmr, sourcemap) with proper type hints and documentation. Template correctly outputs JavaScript boolean and string values.
reflex/environment.py 5/5 Added Literal type interpretation support and two new environment variables (VITE_EXPERIMENTAL_HMR, VITE_SOURCEMAP). The Literal handler correctly processes string, bool, and int literal values.
reflex/utils/frontend_skeleton.py 5/5 Updated _compile_vite_config to pass the two new environment variables (experimental_hmr, sourcemap) to the vite_config_template function.

Sequence Diagram

sequenceDiagram
    participant User
    participant EnvironmentVariables
    participant frontend_skeleton
    participant templates
    participant ViteConfig

    User->>EnvironmentVariables: Set VITE_EXPERIMENTAL_HMR (default: True)
    User->>EnvironmentVariables: Set VITE_SOURCEMAP (default: False)
    
    frontend_skeleton->>EnvironmentVariables: VITE_EXPERIMENTAL_HMR.get()
    EnvironmentVariables-->>frontend_skeleton: bool value
    
    frontend_skeleton->>EnvironmentVariables: VITE_SOURCEMAP.get()
    EnvironmentVariables-->>frontend_skeleton: Literal[False, True, "inline", "hidden"]
    
    frontend_skeleton->>templates: vite_config_template(experimental_hmr, sourcemap)
    templates->>templates: Convert Python values to JS format
    Note over templates: True/False → true/false<br/>"inline"/"hidden" → 'inline'/'hidden'
    templates-->>ViteConfig: Generate vite.config.js content
    ViteConfig-->>User: Apply experimental HMR and sourcemap settings
Loading

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Collaborator

@masenf masenf left a comment

Choose a reason for hiding this comment

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

experimental hmr seems to have trouble when rx.moment is added to an app

  1. create a blank app
  2. load it in the browser
  3. add rx.moment() to the index page
  4. TypeError: Failed to fetch dynamically imported module: http://localhost:3000/node_modules/.vite/deps/react-moment.js?v=ff45da65

@adhami3310 adhami3310 changed the title enable exp hmr and expose sourcemap expose exp hmr and sourcemap Oct 23, 2025
@adhami3310 adhami3310 merged commit 6b043d6 into main Oct 23, 2025
46 of 47 checks passed
@adhami3310 adhami3310 deleted the enable-exp-hmr branch October 23, 2025 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants