-
Notifications
You must be signed in to change notification settings - Fork 14
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
Toaster doesn't work with SSR/SSG #398
Comments
@codylawson do you have any thoughts on this? It looks like react-toastify can be used with SSR, but there is currently no way to tell CR not to import the CSS file behind the scenes. |
@jpeterson What's the preferred way for it to work? Import the css manually instead? |
@codylawson I'm not entirely sure of the best approach here, but based on this page, I feel like we need a way for users to take on the responsibility of importing the CSS. I wonder if we could come up with a solution where passing a prop like I don't know if what we're doing now is an anti-pattern, but I don't want this to introduce a breaking change or make it harder to use for anyone not concerned with SSR/SSG. |
Are there any babel/webpack plugins that take care of this? Not that we shouldn't handle it ourselves, just curious what options there are. |
This is no longer a problem with NextJS apps as of NextJS 9.5.4 announcement: https://nextjs.org/blog/next-10#importing-css-from-third-party-react-components |
Expected Behavior
The Toaster component should work the same in a SSR/SSG app as it does in a client-rendered app.
Current Behavior
./node_modules/react-toastify/dist/ReactToastify.css
being imported causes the following error:This error is documented here:
https://github.com/vercel/next.js/blob/master/errors/css-npm.md
Possible Solution
Steps to Reproduce (for bugs)
ToastContainer
Context + Screenshots
Your Environment
The text was updated successfully, but these errors were encountered: