Closed IlyaLisov closed 3 weeks ago
Make sure you are using the latest version 2.1.2. there is a bug in 2.1.1.
I still have same exception
I think problem is in my import. Because I imported *
, Chart.js can do something in registration and get an error. So Without import *
I can't build project with Vite. I think I need to change something in my config
I tried with Vite and following worked for me.
import { Chart, registerables } from 'chart.js';
import 'chartjs-plugin-trendline';
Chart.register(...registerables);
This is working for me. I am using Vite, React and TypeScript:
import { otherStuff, Chart as ChartJS } from 'chart.js';
import chartTrendLine from 'chartjs-plugin-trendline';
ChartJS.register( otherStuff, chartTrendLine );
I use Vite for building production code. I used this import for trendline to code be compiled:
After opening components with chart, I get exceptions like this:
After removing trendline from registration problem dissappeared. In local deployment everything works
Versions: