Chartjs-Sveltekit, Depencencies working in dev but not loading directly in the routed page after build

1👍

When navigation to the page works but direct access does not, that is a sign that there are issues with server-side rendering. The first access to a page is rendered on the server by default which can cause issues.

E.g. your page code has to avoid accessing any browser APIs outside of onMount as those will not be available on the server. Check the console of the server process and the console in the browser for errors.

You can also turn off SSR by adding an export to +page.js/ts.

export const ssr = false;

I would only recommend this for finding out whether SSR is the problem. Turning it off permanently should only be done in rare occasions when absolutely necessary.

Leave a comment