Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error usage with snowpack #80

Closed
rifaldhiaw opened this issue Jan 5, 2021 · 5 comments
Closed

Error usage with snowpack #80

rifaldhiaw opened this issue Jan 5, 2021 · 5 comments

Comments

@rifaldhiaw
Copy link

I wanna use this lib in the snowpack App.
But then, it throws

The requested module '../../web_modules/@nandorojo/swr-firestore.js' does not provide an export named 'useDocument'

Thanks

@nandorojo
Copy link
Owner

nandorojo commented Jan 5, 2021

I haven't used Snowpack, so I'm not sure. The docs provided show how to use it in general React. There are also some GitHub issues for usage with Next.js. However, I’m not familiar with Snowpack, so I can't help here.

Please let me know if you figure it out!

@rifaldhiaw
Copy link
Author

rifaldhiaw commented Jan 5, 2021

Most likely, the problem is because of the common Js module, and the snowpack needs it to be an ESM.
FredKSchott/snowpack#440

however, when I tried the workaround that is written here, it still won't work 🤔
https://dev.to/dance2die/snowpack-the-requested-module-webmodules-recoil-js-does-not-provide-an-export-named-recoilroot-1b84

@mewhhaha
Copy link

mewhhaha commented Feb 28, 2021

I had the same issue. Never managed to resolve it, but tried with Vite which also uses esm modules but does prebundling of commonjs modules and had better results. However got another error when I tried starting it. I would get cannot read length of undefined as a result of firebase.apps.length in the Fuego class. It seems that the import * as firebase from 'firebase/app' statement is the culprit. I tried cloning the repo, and linking to a build where I had replaced the statement with import firebase from 'firebase/app' and it worked.

@nandorojo
Copy link
Owner

Solution to that is here #59 (comment)

@mewhhaha
Copy link

:-) Thanks for a solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants