S
SolidJS•11mo ago
jesseb34r

template not exported from solidjs/web

I'm trying to use the solid-spinner library https://github.com/lenniezelk/solid-spinner but am getting an error that solidjs/web doesn't export 'template'. Does anyone know what's going on here?
GitHub
GitHub - lenniezelk/solid-spinner
Contribute to lenniezelk/solid-spinner development by creating an account on GitHub.
12 Replies
foolswisdom
foolswisdom•11mo ago
Usually this happens due to a combination of client side code with ssr version of solid
jesseb34r
jesseb34r•11mo ago
oh interesting
foolswisdom
foolswisdom•11mo ago
Ryan Carniato (@RyanCarniato)
The solution to 90% of the Vite problems people report to me: optimizeDeps.exclude ssr.noExternal
Likes
331
Twitter
jesseb34r
jesseb34r•11mo ago
how do I use code like this then if I have ssr? is that just not possible? lol I'll give it a try
foolswisdom
foolswisdom•11mo ago
It depends on the library. Some libraries there's nothing you can do, some of them that tweet works
jesseb34r
jesseb34r•11mo ago
does optimizeDeps go in the ssr options as well?
foolswisdom
foolswisdom•11mo ago
No It's top level
jesseb34r
jesseb34r•11mo ago
so like
ssr: {
noExternal: ["@kobalte/core", "solid-spinner"]
},
optimizeDeps: {
exclude: ["solid-spinner"]
}
ssr: {
noExternal: ["@kobalte/core", "solid-spinner"]
},
optimizeDeps: {
exclude: ["solid-spinner"]
}
foolswisdom
foolswisdom•11mo ago
In the vite config, not in the solid plugin Yes It looks like the spinner library ships esm and source (which is the default for the rollup solid plugin). The esm is the client build, and you basically need a way to get solid to compile from source for the server side Maybe those vite options make that happen, maybe they don't, it's been a long time since I've tried wrangling with server side deps Personally, I ship a separate cjs build for server side for my libraries
jesseb34r
jesseb34r•11mo ago
it looks like I am not getting that error anymore so that's cool now I gotta actually try to render a spinner
foolswisdom
foolswisdom•11mo ago
Yeah, it could be the library itself doesn't work with server side... Gotta see It seems to be all purely svg based (no use of browser apis), so I'd assume it works
jesseb34r
jesseb34r•11mo ago
successfully got it working now that I'm no longer putting my kid down for a nap 🤣 thanks for the help