cahilfoley / react-snowfall

A high performance, canvas based react component that creates a snowfall effect
https://cahilfoley.github.io/react-snowfall/
MIT License
389 stars 22 forks source link

Issue with remix (tsx) #70

Closed theskillwithin closed 9 months ago

theskillwithin commented 10 months ago

Warning: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object

cahilfoley commented 9 months ago

Hello - thanks for raising an issue - I don't use remix much, do you have a reproduction that you could share for this issue so I could try to help? Thanks.

theskillwithin commented 9 months ago

@cahilfoley Thank you! created remix reproduction repo https://github.com/theskillwithin/react-snowfall-remix

cahilfoley commented 9 months ago

Thanks for taking the time to create the repro! I've made a small tweak and release version 2.1.0 to help get this working. After bumping the version to 2.1.0 the only other change I needed to make to get it working was to add the serverDependenciesToBundle property to the remix.config.js file like this:

export default {
  ignoredRouteFiles: ['**/.*'],
  serverDependenciesToBundle: ['react-snowfall'], // The library is published as ESM and remix uses CJS so it needs to be included in the bundle
}