Skip to content

Conversation

@nikhilsaikethe
Copy link
Contributor

@nikhilsaikethe nikhilsaikethe commented Oct 21, 2025

User description

adding this to home page will stop rendering the charts


PR Type

Bug fix


Description

  • Remove ECharts from optimizeDeps exclude

  • Allow pre-bundling of ECharts modules

  • Fix homepage charts not rendering


Diagram Walkthrough

flowchart LR
  ViteConfig["vite.config.ts optimizeDeps"] -- "remove exclude for ECharts" --> OptimizeDeps["ECharts pre-bundled"]
  OptimizeDeps -- "modules available at runtime" --> HomepageCharts["Homepage charts render"]
Loading

File Walkthrough

Relevant files
Bug fix
vite.config.ts
Allow ECharts to be optimized by Vite                                       

web/vite.config.ts

  • Remove optimizeDeps.exclude entries for ECharts subpackages.
  • Keep esbuildOptions and force configuration unchanged.
+0/-7     

@github-actions github-actions bot added ☢️ Bug Something isn't working Review effort 1/5 labels Oct 21, 2025
@github-actions
Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Build Behavior

Verify that allowing ECharts to be pre-bundled does not inflate dev server cold-start time or production bundle size unexpectedly; confirm no duplicate ECharts instances and that SSR/build still work.

optimizeDeps: {
  esbuildOptions: {
    plugins: [NodeGlobalsPolyfillPlugin({ buffer: true })],
    target: "es2020",
  },
  force: false,
},
Compatibility

Ensure all ECharts subpaths used in the app resolve correctly when pre-bundled (e.g., tree-shaking and dynamic imports), and that plugin polyfills remain sufficient for ECharts runtime.

  esbuildOptions: {
    plugins: [NodeGlobalsPolyfillPlugin({ buffer: true })],
    target: "es2020",
  },
  force: false,
},

@github-actions
Copy link
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Shim global for browser prebundle

If you removed dependency exclusions to fix ECharts runtime, ensure optimizeDeps
won't prebundle problematic ESM that depends on Node globals. Add define shims for
global to avoid ReferenceError in the browser when plugins/polyfills don't fully
cover it. This prevents hard-to-debug failures during dev prebundling.

web/vite.config.ts [207-213]

 optimizeDeps: {
   esbuildOptions: {
     plugins: [NodeGlobalsPolyfillPlugin({ buffer: true })],
     target: "es2020",
+    define: {
+      global: "globalThis",
+    },
   },
   force: false,
 },
Suggestion importance[1-10]: 6

__

Why: Adding define: { global: "globalThis" } inside esbuildOptions is a reasonable, low-risk improvement to avoid global ReferenceErrors during optimizeDeps prebundling, complementing the Node globals polyfill. It's contextually relevant after removing exclusions, but it's preventive rather than fixing a confirmed bug.

Low

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

removed echarts modules from Vite's optimizeDeps.exclude configuration to fix chart rendering issues on the homepage

Key changes:

  • Removed exclusion of echarts/core, echarts/renderers, echarts/components, echarts/features, and echarts/charts from Vite's dependency optimization
  • Allows Vite to properly pre-bundle echarts dependencies, which was preventing CustomChartRenderer components from working correctly on the homepage
  • The exclusion was causing runtime import issues that prevented charts from displaying

Context:
The homepage (HomeView.vue) uses CustomChartRenderer components that depend on echarts modules. By excluding these from Vite's optimization, the modules weren't being properly bundled, causing rendering failures. This change aligns with the existing manualChunks configuration (lines 169-175) which already bundles echarts modules together.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change removes an unnecessary exclusion that was breaking chart functionality. The echarts modules are already configured in manualChunks for proper bundling, making the exclude unnecessary and problematic. No logical issues or syntax errors introduced.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
web/vite.config.ts 5/5 removed echarts modules from vite optimizeDeps exclude list to allow proper dependency pre-bundling, fixing chart rendering on homepage

Sequence Diagram

sequenceDiagram
    participant Browser
    participant Vite
    participant EchartsDeps as Echarts Dependencies
    participant HomePage
    participant ChartRenderer
    
    Note over Vite,EchartsDeps: Build Time Configuration
    Browser->>Vite: Request app bundle
    
    alt Before Fix (with exclude)
        Vite->>EchartsDeps: Skip pre-bundling (excluded)
        Note over EchartsDeps: echarts/core, echarts/charts, etc.<br/>not optimized by Vite
        Vite->>Browser: Return bundle
        Browser->>HomePage: Load home page
        HomePage->>ChartRenderer: Render CustomChartRenderer
        ChartRenderer->>EchartsDeps: Import echarts modules
        Note over ChartRenderer,EchartsDeps: Runtime import issues<br/>Charts fail to render
    end
    
    alt After Fix (without exclude)
        Vite->>EchartsDeps: Pre-bundle echarts modules
        Note over EchartsDeps: Optimized dependency bundling
        Vite->>Browser: Return optimized bundle
        Browser->>HomePage: Load home page
        HomePage->>ChartRenderer: Render CustomChartRenderer
        ChartRenderer->>EchartsDeps: Import pre-bundled echarts
        Note over ChartRenderer,EchartsDeps: Charts render successfully
    end
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: nikhilsaikethe | Branch: home-page-echarts-issue | Commit: cfb1f7b

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 364 342 0 19 3 94% 4m 39s

View Detailed Results

@hengfeiyang hengfeiyang merged commit 5ec9379 into main Oct 21, 2025
33 checks passed
@hengfeiyang hengfeiyang deleted the home-page-echarts-issue branch October 21, 2025 02:04
uddhavdave pushed a commit that referenced this pull request Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

☢️ Bug Something isn't working Review effort 1/5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants