Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tree shaking chart.js #89

Closed
1 of 4 tasks
lsnow99 opened this issue Jan 27, 2022 · 1 comment
Closed
1 of 4 tasks

Tree shaking chart.js #89

lsnow99 opened this issue Jan 27, 2022 · 1 comment

Comments

@lsnow99
Copy link

lsnow99 commented Jan 27, 2022

Describe the bug

Having trouble getting tree-shaking to work with Chart.js and vue-chart-3

To Reproduce

In my main.js:

// Import depedencies for vue-chart-3 from chart.js
import {
  Chart,
  BarElement,
  Tooltip,
  Legend,
  BarController,
  CategoryScale,
  LinearScale,
  PieController,
  ArcElement,
} from "chart.js";
Chart.register(
  BarController,
  BarElement,
  Tooltip,
  Legend,
  CategoryScale,
  LinearScale,
  PieController,
  ArcElement
);

I am getting this result when I analyze my vendor bundle:
image

In vue-chart-3/dist/components.js I see this (line 7 for me):
const chart_js_1 = require("chart.js");

So is it possible vue-chart-3 isn't using tree shaking?

Version of vue-chart-3

v3.0.9

Version of Vue

3.2.29

  • Vue 3
  • Vue 2
  • Nuxt 2
  • Nuxt 3
@lsnow99
Copy link
Author

lsnow99 commented Jan 27, 2022

Looking into it more, it may be that my visualizer tool does not have great support for treeshaking: btd/rollup-plugin-visualizer#96

@lsnow99 lsnow99 closed this as completed Jan 27, 2022
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

No branches or pull requests

1 participant