fkhadra / react-toastify

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

Question: Using react-toastify as a plain browser script #934

Open dnguneratne opened 1 year ago

dnguneratne commented 1 year ago

Library works great when used as part of a React project. However, is it possible to import this library as a plain browser script resource as well? I tried using a bundled file from unpkg but ran into the following error.

What is the current behavior? Console error on the browser: image

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: To reproduce: Copy, <script src="https://unpkg.com/react-toastify@9.0.8/dist/react-toastify.umd.js"></script>, at the end of HTML body tag.

What is the expected behavior? react-toastify to work when imported as a script.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? Chrome v110.0.5481.100

quarsee commented 10 months ago

Library works great when used as part of a React project. However, is it possible to import this library as a plain browser script resource as well? I tried using a bundled file from unpkg but ran into the following error.

What is the current behavior? Console error on the browser: image

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: To reproduce: Copy, <script src="https://unpkg.com/react-toastify@9.0.8/dist/react-toastify.umd.js"></script>, at the end of HTML body tag.

What is the expected behavior? react-toastify to work when imported as a script.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? Chrome v110.0.5481.100

hey! did you find a solution or did you give up? because no response & fix from the developer @dnguneratne

fkhadra commented 8 months ago

Hey @Quarsee could you try with https://unpkg.com/react-toastify@10.0.0-beta.1/dist/react-toastify.umd.js to see if the issue persist ?

quarsee commented 8 months ago

@fkhadra Right now I am facing with toast is not defined I also tried container version out there I got ToastContainer is not defined.