tsparticles / solid

Solid.js tsParticles official component
MIT License
13 stars 1 forks source link

Typescript support? #11

Closed kevinelliott closed 11 months ago

kevinelliott commented 11 months ago

Is there an example using Solid.js + Typescript?

matteobruni commented 11 months ago

There is one in this repository

https://github.com/tsparticles/solid/tree/main/apps/solid/src

kevinelliott commented 11 months ago

Thanks! I presume that means I need to add tsparticles with npm as well.

matteobruni commented 11 months ago

Thanks! I presume that means I need to add tsparticles with npm as well.

It's not mandatory, you can load tsparticles-basic, tsparticles-slim, tsparticles, tsparticles-all, or any preset and load the right function. Obviously some packages lack some features, only all contains everything except presets

kevinelliott commented 11 months ago

This doesn't appear to work with Solid.js + Typescript + Cloudflare Pages (and miniflare).

5:32:32 PM [vite] Error when evaluating SSR module /src/routes/index.tsx: failed to import "solid-particles" |- ReferenceError: self is not defined 5:32:32 PM [vite] Error when evaluating SSR module /node_modules/solid-start/root/FileRoutes.tsx: failed to import "/src/routes/index.tsx" |- ReferenceError: self is not defined etc...

matteobruni commented 11 months ago

The package must be used client side only, animation libraries can't be run server side

kevinelliott commented 11 months ago

Alright, I will have to try and see if I can disable the server side of this project then.