Replies: 1 comment
-
I avoid cjs entirely but there's a lot of info about this around Vite. Check this out: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
hello, im new to this project trying to build my first demo and found myself wanting to use mysql2.
having used svelte and mysql2 before ithought it to be possible however coudnt figure it out.
itried using require which made vite raise errors.
i was unable to use regular imports
and got this:
client-manifest.js?t=1665420084950:14 TypeError: Cannot read properties of undefined (reading 'prototype')
at node_modules/safer-buffer/safer.js (safer.js:25:33)
at __require2 (chunk-7FP5O474.js?v=a41bda75:10:50)
at node_modules/iconv-lite/lib/index.js (index.js:3:14)
at __require2 (chunk-7FP5O474.js?v=a41bda75:10:50)
at node_modules/mysql2/lib/parsers/string.js (string.js:3:15)
at __require2 (chunk-7FP5O474.js?v=a41bda75:10:50)
at node_modules/mysql2/lib/packets/packet.js (packet.js:11:22)
at __require2 (chunk-7FP5O474.js?v=a41bda75:10:50)
at node_modules/mysql2/lib/packet_parser.js (packet_parser.js:3:16)
at __require2 (chunk-7FP5O474.js?v=a41bda75:10:50)
digging into the code i belive this is because the package is using require itself.
is there any way to use it with require?
Beta Was this translation helpful? Give feedback.
All reactions