nandorojo / dripsy

šŸ· Responsive, unstyled UI primitives for React Native + Web.
https://dripsy.xyz
MIT License
2.01k stars 80 forks source link

TypeError: (0, _.css) is not a function. #120

Closed shamblid closed 3 years ago

shamblid commented 3 years ago

I am getting this error all of a sudden using dripsy 2.2.0 and even after updating to 2.3.6. The error occurs in the map-props.ts file in the core css dripsy folder.

The solution I've found is to change that line above to ./ instead of just .

https://github.com/nandorojo/dripsy/blob/baae1f2a99730153a25b61819d0a11564c9f5a06/packages/core/src/css/map-props.ts#L2

I've looked up module resolution stuff and found that ./ points to the current location while . points to "this location". I'm unsure what exactly the difference is besides maybe different behavior from javascript. I'm also confused as to why this happens only for this specific file where . is used in other files in the project. As well as the fact that this only recently happened with no changes to my codebase.

I figured I'd throw this up until I find if there's something I'm missing with module resolution because I can't really believe it would be the libraries fault.

nandorojo commented 3 years ago

I was just facing this issue myself for a separate file like an hour ago in my appā€¦changing . to ./index solved it šŸ§ weird timing, I wonder if itā€™s a coincidence. Iā€™m not getting any Dripsy errors though.

what platform?

nandorojo commented 3 years ago

B6393A1B-7AAB-415C-A598-AA60B8FCFEC6

this is what I sent to expo like half an hour ago. Not sure what that could be

shamblid commented 3 years ago

Not using expo its just a bare react native app.

shamblid commented 3 years ago

Timing is probably coincidence though I've had this problem for over a week at least, I just haven't looked too deeply into it until now.

But yeah seems like we have the same exact issue. I found some stack overflows about the . vs ./ here: https://stackoverflow.com/questions/296873/how-to-set-relative-path-to-current-folder https://stackoverflow.com/questions/7591240/what-does-dot-slash-refer-to-in-terms-of-an-html-file-path-location

Not sure if they are related here but nice context and they mention that ./ only works in non-strict mode which I'm unsure if that is affected by metro.

nandorojo commented 3 years ago

Interesting. Yeah I havenā€™t actually had Dripsy issues from this. Feel free to PR those imports though with ./index