Version
5.4.0
Link to Minimal Reproduction
https://github.com/MatthewAry/echarts-scatter-label-bug
Steps to Reproduce
Background:
The file with the chart is located in src/components/EChart.vue
Reproduction Steps:
Step 0: It goes without saying that you need to clone and then use yarn to download all dependencies.
View in the development server:
Step 1: To view the chart in the dev environment run yarn run dev and vite will give you a link to view the application on the dev server which you can open in the browser. You should be able to see the chart as shown in the first picture seen in the current behavior section.
Build For Production and Preview:
Step 1: run yarn run build
Step 2: run yarn run preview and again vite will give you a link to view the compiled SPA on the preview server. You should be able to see the chart as shown in the second picture above.
Current Behavior
When running from the dev server the chart renders as expected

But when built for production, the chart renders like this (unexpected)

Expected Behavior
There is a general expectation that (unless it is explicitly desired), there should be no difference between what you see from a dev server and what you get in production, but this expectation is not holding here.
Instead we're seeing that the labelLayout and labelLine are not taking effect when the SPA is built for production.
Environment
- OS: macOS Monterey
- Browser: Chrome 106.0.5249.119
- Framework: Vue 2, Vite
Any additional comments?
I'm not sure why this is breaking, but I suspect that vite and rollup (which vite uses) has something to do with this. I did try a few things, I disabled minification on build (which is done using terser) to no effect. I also manually put ECharts into its own chunk. It's hard to speculate as to what the problem is but you might find this page https://vitejs.dev/config/build-options.html helpful.
I used https://github.com/logue/vite-vue2-vuetify-ts-starter to make my reproduction. This saved me a ton of time when making a reproduction of what I am seeing.
Version
5.4.0
Link to Minimal Reproduction
https://github.com/MatthewAry/echarts-scatter-label-bug
Steps to Reproduce
Background:
The file with the chart is located in
src/components/EChart.vueReproduction Steps:
Step 0: It goes without saying that you need to clone and then use yarn to download all dependencies.
View in the development server:
Step 1: To view the chart in the dev environment run
yarn run devand vite will give you a link to view the application on the dev server which you can open in the browser. You should be able to see the chart as shown in the first picture seen in the current behavior section.Build For Production and Preview:
Step 1: run
yarn run buildStep 2: run
yarn run previewand again vite will give you a link to view the compiled SPA on the preview server. You should be able to see the chart as shown in the second picture above.Current Behavior
When running from the dev server the chart renders as expected


But when built for production, the chart renders like this (unexpected)
Expected Behavior
There is a general expectation that (unless it is explicitly desired), there should be no difference between what you see from a dev server and what you get in production, but this expectation is not holding here.
Instead we're seeing that the
labelLayoutandlabelLineare not taking effect when the SPA is built for production.Environment
Any additional comments?
I'm not sure why this is breaking, but I suspect that vite and rollup (which vite uses) has something to do with this. I did try a few things, I disabled minification on build (which is done using terser) to no effect. I also manually put ECharts into its own chunk. It's hard to speculate as to what the problem is but you might find this page https://vitejs.dev/config/build-options.html helpful.
I used https://github.com/logue/vite-vue2-vuetify-ts-starter to make my reproduction. This saved me a ton of time when making a reproduction of what I am seeing.