I was doing a short project on real time-chat, everything is working fine in development mode, but when I build the dist
folder for deployment,It doesn't work
In my code there is no CommonJS code, as I am only working on only ECMAScript modules. But after building the project I am gettingUncaught ReferenceError: require is not defined
.
And I have found that require does exist on my dist
folder
require("websocket").w3cwebsocket;var Nw=require("websocket").w3cwebsocket
this is the part which is making error.
So,I tried to get rid of these require
as it is showing as a error, But changing after vite.config.js
file
build: { target: 'modules', },
So, I don't get require
, still it's not working. Can anyone help me with this?