-
Notifications
You must be signed in to change notification settings - Fork 18
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
Docs: Add a "web support" section #88
Comments
Dope! |
When I try to add Sonner to my project and use it on the web, as you described, I encounter the following error: 'Unable to resolve "sonner" from "src/lib/Sonner/index.web.ts".' Do you know how to solve this issue? Thank you for your great work! |
Could you show me more code for context? |
I created a basic reproduction example here: In my tests, the only way to make Sonner work is by editing node_modules/sonner/package.json to include a main field. This way, I can run the web app with Sonner working. |
@GustavoBonfimS thanks. Is platform specific file endings working in the project in general? If you just create some Text component that says "Hello" on native and "Hello Web" on .web.tsx? |
Yes, I have platform-specific file extensions in other files in my app, and they worked fine before adding Sonner. Could Sonner be breaking because of the Package Exports support in React Native? Are you able to use Sonner by following the setup in the documentation? |
I'm using this setup in my production apps. There's one slight difference: // toast.ts
export { toast, Toaster } from "sonner-native"; // toast.web.ts
export { toast, Toaster } from "sonner"; Could you try that instead of the * export? |
This is causing errors as well 😢 What version of React Native are you using in your app? Could you try creating a new expo project and installing the library? |
Seems like an open issue in Sonner: emilkowalski/sonner#473 |
Been receiving a few questions if this has web support.
Would want to point out to the following setup:
And mention that the APIs match so it will work on native & web platforms.
The text was updated successfully, but these errors were encountered: