Vincent Udén
Explore posts from serversSyntaxError: The requested module 'solid-js/web' does not provide an export named 'classList'
Yeah it's been a suprisingly common problem for me, components breaking in ssr. I'm not clever enough to figure out the solutions if there are any goods ones. It's a little bit demotivating tbh, but at least there are usually alternative libraries which do work
5 replies
SyntaxError: The requested module 'solid-js/web' does not provide an export named 'classList'
I've had some problems with similar issues but I'm no expert so forgive me if I'm wrong.
The problem is that solid-slider expects to be rendered only on client and thus uses the
classList
export from solid-js/web
either directly or in one of it's dependencies. classList
isn't exported from the server version of solid-js/web
much like template
or some other constructs due to the SSR not being done in a browser, but rather in node.
For me the fix has been to import some of my components as client only. This means they don't get SSRed but still allows me to use them. To do this, use
Where you replace the import with your component that needs to be client only.
This hasn't worked in all cases for me. I have no good understanding of when it works and when it doesn't. I've asked about it here before and got no answer. Also I realise this assumes you're using solid-start which you might not be. If you aren't, I wish you the best of luck on finding another solution5 replies