Require is not defined in only the production build not in local machine

I am working with a rich text editor named react-quilljs. I created my project with "vite": "^4.1.0"
In my local machine, the reach text editor shows up but when I host it, I am not able to view the page. The page is all blank. And in the console it says:

ReferenceError: require is not defined
    at index-1e54aaaf.js:193:31693
    at Za (index-1e54aaaf.js:38:20704)
    at cf (index-1e54aaaf.js:38:21172)
    at Object.useState (index-1e54aaaf.js:38:27566)
    at QS.Ge.useState (index-1e54aaaf.js:9:6487)
    at HD (index-1e54aaaf.js:193:31529)
    at QD (index-1e54aaaf.js:193:32289)
    at lf (index-1e54aaaf.js:38:19884)
    at gf (index-1e54aaaf.js:40:3138)
    at Lv (index-1e54aaaf.js:40:45128)


my site name is: mediaid-online-platform

What is the problem here? if the commonJs require() function is the issue then why is it running in the localhost? Please guide me. I don’t find any solution. Tried to configure my vite.config file but no success. please help me.

Can you take a look at this:

Hi! Im having tthe same issue. Did you fix it?