Open DerYumin opened 1 year ago
I am encountering exactly same issues now. Have anyone been able to find solution to this?
@alamorre I am also encountering this very issue. "npm run dev" command works fine but when trying to deploy a production build on Vercel or Netlify (I tried both). This require("websocket").w3cwebsocket
error is thrown. Is there any fix for this?
Same here as well. Runs on dev fine (desktop version at least), but getting "require is not defined" when deploying to Vercel. Even tried to redefine the build structure in vite.config.js
and no luck.
Im also get problem after deployed on render. Its work on my local with npm run dev but it crash in production with beautiful red star on require("websocket").w3cwebsocket which help nothing. TT
Same for me as well
If you're using vite, I was getting the same exact issue too until I added this to my vite.config.js
file.
commonjsOptions: {
transformMixedEsModules: true
This is my config file now:
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import * as path from "path";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
resolve: {
alias: [{ find: "@", replacement: path.resolve(__dirname, "src") }]
},
// Fix large chunks issue due to node_modules
build: {
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes("node_modules")) {
return id
.toString()
.split("node_modules/")[1]
.split("/")[0]
.toString();
}
}
}
},
commonjsOptions: {
transformMixedEsModules: true
}
}
});
same here
Hello chatengine.io Team,
I have an issue with the production of my build. When I run locally with "npm run dev", there is no problem with my client and Chat. But when I deployed a production build on vercel, I got following Error:
Uncaught ReferenceError: require is not defined at index-46340fac.js:156:35877 with the following code there:
require("websocket").w3cwebsocket;