expo / snack

Expo Snack lets you run Expo in the browser.
https://snack.expo.dev
MIT License
373 stars 110 forks source link

react-firebase-hooks fails to resolve on Snack #134

Open peterpme opened 3 years ago

peterpme commented 3 years ago

Summary

Adding react-firebase-hooks to a new Snack returns this error and making it unusable:

Failed to resolve dependency 'react-firebase-hooks@*' (Can't resolve '' in '/tmp/snackager/snackager/buildStatus/1/react-firebase-hooks@3.0.4-ios,android,web/package')

What platform(s) does this occur on?

Android, iOS, Web

SDK Version

40/41

Reproducible demo or steps to reproduce from a blank project

Add import "react-firebase-hooks" to a new Snack. No import necessary

https://snack.expo.io/@peterpme/20b3d4

byCedric commented 3 years ago

Hi @peterpme, sorry for the delay!

This package seems to have a node-heavy structure, and Snackager seems to not-like that. What happens in the module is that everything is split up into 4 different sub-modules. The module react-firebase-hooks contains 4 different modules, in each folder. They aren't independently submitted as a package, instead, they rely on package.json files within them.

The main problem that actually causes the error in Snackager is the invalid main field in the root package.json (pun intended). It points to ./dist/index.cjs.js, but that doesn't exist, causing Snackager to being unable to find the entry point and bundle from there.

Importing react-firebase-hooks/auth seems to work in Snackager, but because it requires react-firebase-hooks as peer dependency, it's blocked because of the main issue.