-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught Error: Dynamic require of “events” is not supported #95
Comments
Hi, did you solve this problem? I'm getting same error in my project on electron+vite+react, when trying to add Discord-rpc package. Error: Dynamic require of "events" is not supported I'v tried to fix this be converting all require statements to import inside node_modules, but this dose not seem to be the case, because when i use debugger to inspect files in browser they are still require statements. |
Hi, I think the cause of this issue is that the browser does not support Node’s core modules.Try the vite-plugin-node-polyfills package.Another package, nodes7, works fine after I added the vite-plugin-node-polyfills package, but node-snap7 still does not. |
Hello,
I’m using your node-snap7 package in a Vite project and I’ve encountered an issue. When I try to run my project, I get the following error:
Uncaught Error: Dynamic require of "events" is not supported
at chunk-6NOISVLF.js?v=2f01d05e:10:9
at node_modules/.vite-electron-renderer/events.mjs (events.mjs:1:50)
at __init (chunk-6NOISVLF.js?v=2f01d05e:13:56)
at node_modules/node-snap7/lib/node-snap7.js (node-snap7.js:6:14)
at __require2 (chunk-6NOISVLF.js?v=2f01d05e:16:50)
at node-snap7.js:59:78
It seems like the issue is related to the dynamic require of “events”. I understand that Vite prefers ES6 import syntax over CommonJS require, which might be causing this issue.Do you know any solutions to this problem?Thank you for your time and for the work you’ve put into this package.
The text was updated successfully, but these errors were encountered: