reuters-graphics / bluprint_graphics-kit

SvelteKit rig for graphics and newsapps
https://reuters-graphics.github.io/docs_graphics-kit/
21 stars 3 forks source link

Consider turning off SSR in dev #31

Closed hobbes7878 closed 3 years ago

hobbes7878 commented 3 years ago

One of the most flummoxing things for new folks are 500 errors Vite occasionally throws warning an element (usually anything using d3...) is not a valid SSR component.

SSR is still experimental in Vite and they're absolutely dealing with issues resolving dependencies, especially CJS ones.

If we turn off SSR in development only, then we don't get any more phantom 500s. Though we may then get more apps that don't build because someone is using window or something outside a lifecycle function.

Still, though, the relative frequency of using d3 vs. using non-Node compliant code probably tilts this in favour of disabling until Vite makes a few strides.

hobbes7878 commented 3 years ago

Decided to add as an option folks can uncomment in sveltekit config and documented why you might and might not want to use it.