JamesBrill / react-speech-recognition

💬Speech recognition for your React app
https://webspeechrecognition.com/
MIT License
657 stars 119 forks source link

why this module not supporting in nextJs? #57

Closed singh-anita closed 3 years ago

singh-anita commented 4 years ago

This is working for reactJs but not for nextJs and showing an error that ReferenceError: regeneratorRuntime is not defined

JamesBrill commented 4 years ago

Hi @singh-anita See my comments on your last issue https://github.com/JamesBrill/react-speech-recognition/issues/48#issuecomment-666801823

I believe this is an issue that is solvable within Babel, which is agnostic about which React framework you're using (Create React App, NextJS, etc). As suggested in my last comment, this should be solvable by installing and importing regenerator-runtime, or alternatively by tweaking the Babel config, which NextJS seems to enable this way. Although I do not have much experience with NextJS, my understanding of this problem tells me it is not an issue with NextJS specifically.

Let me know how you get on. If you're still stuck, I'll have a go at spinning up a NextJS project and see if there's some quirk in NextJS' compilation config that I'm not aware of.

Raggok commented 3 years ago

to bypass this error i added import "regenerator-runtime/runtime" but then i got ReferenceError: navigator is not defined at react-speech-recognition/lib/isAndroid.js

JamesBrill commented 3 years ago

The navigator issue is a server-side rendering problem, which @Raggok kindly fixed. @singh-anita give version 3.2.2 a try.