fkhadra / react-toastify

React notification made easy 🚀 !
https://fkhadra.github.io/react-toastify/introduction
MIT License
12.33k stars 676 forks source link

`injectStyle` throws error in v10 #1045

Closed Lukas742 closed 5 months ago

Lukas742 commented 5 months ago

Do you want to request a feature or report a bug? Bug

What is the current behavior? When calling injectStyle the following build error is shown:

Error: Build failed with 1 error:
node_modules/react-toastify/dist/inject-style.esm.mjs:4:4122: ERROR: Expected ";" but found "\";position:absolute;left:0;right:0;height:calc(var(--g) * 1px);bottom:100%}.Toastify__toast--stacked[data-pos=top]{top:0}.Toastify__toast--stacked[data-pos=bot]{bottom:0}.Toastify__toast--stacked[data-pos=bot].Toastify__toast--stacked:before{transform-origin:top}.Toastify__toast--stacked[data-pos=top].Toastify__toast--stacked:before{transform-origin:bottom}.Toastify__toast--stacked:before{content:\""

This bug was introduced with v10, with v9 injectStyle was working fine. I'm using the standard Vite v5 template.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your CodeSandbox (https://codesandbox.io/s/new) example below:

https://stackblitz.com/edit/vitejs-vite-85nrpq?file=src%2FApp.tsx

Edit: The same error is thrown with CRA (only formulated differently): https://codesandbox.io/p/sandbox/infallible-https-v76v6y?file=%2Fsrc%2FApp.js%3A13%2C1

To reproduce:

  1. Go to the stackblitz example
  2. See that the build fails with the described error

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? React: ^18.2.0 react-toastify: 10.0.2

fkhadra commented 5 months ago

Hey @Lukas742 thanks for reporting the issue 🙏. It's fixed now