It doesn't matter if I build my design system as umd or commonjs2, when using the design system in a Nuxt project I get the window is not defined error.
Of course, some components in my design system use window (they have to) but my question is that when building the system, how are we able to tell Nuxt not to choke on these references? Every component is lumped together in one single JS and CSS file.
The only way I can get around these errors is to specify ssr: false in my Nuxt config for the plugin that imports the design system, but that defeats the point of using Nuxt at all. I need a level of SSR.
Any ideas? I can't possibly be the only one hitting this issue?
It doesn't matter if I build my design system as
umd
orcommonjs2
, when using the design system in a Nuxt project I get thewindow is not defined
error.Of course, some components in my design system use window (they have to) but my question is that when building the system, how are we able to tell Nuxt not to choke on these references? Every component is lumped together in one single JS and CSS file.
I have followed the steps outlined here multiple times, being very careful to follow every step: https://github.com/viljamis/nuxt-design-system
The result is always the same.
The only way I can get around these errors is to specify
ssr: false
in my Nuxt config for the plugin that imports the design system, but that defeats the point of using Nuxt at all. I need a level of SSR.Any ideas? I can't possibly be the only one hitting this issue?