5👍
Vite causes this. It’s both sveltekit’s greathest strength and weakest link.
Just add these lines to the config object within your svelte.config.js
file and you should be fine :
const config = {
kit: {
// ...
vite: {
ssr:{
noExternal: ['chart.js']
}
}
}
};
- [Chartjs]-How to use 'time' (data from database, data type: timestamp ) for plotting graph in Chart JS
- [Chartjs]-ChartJS vertical line not removed on touchend
3👍
addition to Tonton-blax awnser. The vite docs say ‘Prevent listed dependencies from being externalized for SSR. If true, no dependencies are externalized.’. So how i read it is that the dependency is accessible on the server side.
const config = {
kit: {
// ...
vite: {
ssr:{
noExternal: ['chart.js']
}
}
}
};
- [Chartjs]-Chart.js – Plot line graph with X , Y coordinates
- [Chartjs]-Angular2 ng2-chart customizations?
Source:stackexchange.com