From 9e6e8c069d0b35e1d7480e2077a9caa15630e73d Mon Sep 17 00:00:00 2001 From: vcoppe Date: Mon, 12 Aug 2024 19:13:13 +0200 Subject: [PATCH] fix crawling issue --- website/src/lib/components/ElevationProfile.svelte | 6 +++--- website/src/routes/+layout.js | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/website/src/lib/components/ElevationProfile.svelte b/website/src/lib/components/ElevationProfile.svelte index e752eca8..3885816f 100644 --- a/website/src/lib/components/ElevationProfile.svelte +++ b/website/src/lib/components/ElevationProfile.svelte @@ -2,7 +2,6 @@ import * as ToggleGroup from '$lib/components/ui/toggle-group'; import Tooltip from '$lib/components/Tooltip.svelte'; import Chart from 'chart.js/auto'; - import zoomPlugin from 'chartjs-plugin-zoom'; import mapboxgl from 'mapbox-gl'; import { map } from '$lib/stores'; import { onDestroy, onMount } from 'svelte'; @@ -69,7 +68,6 @@ let overlay: HTMLCanvasElement; let chart: Chart; - Chart.register(zoomPlugin); Chart.defaults.font.family = 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"'; // Tailwind CSS font @@ -294,7 +292,9 @@ } }; - onMount(() => { + onMount(async () => { + Chart.register((await import('chartjs-plugin-zoom')).default); // dynamic import to avoid SSR and 'window is not defined' error + chart = new Chart(canvas, { type: 'line', data: { diff --git a/website/src/routes/+layout.js b/website/src/routes/+layout.js index ed97adf6..ed90b52f 100644 --- a/website/src/routes/+layout.js +++ b/website/src/routes/+layout.js @@ -1,5 +1,4 @@ export const prerender = true; -export const ssr = false; import { languages } from '$lib/languages'; import { register, init } from 'svelte-i18n';