-
Notifications
You must be signed in to change notification settings - Fork 569
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
TypeError: Cannot destructure property 'Server' of '_engineIo.default' #657
Comments
Hi! Unfortunately I'm not able to reproduce the issue, either with TS/plain JS or CJS/ESM imports. Could it be linked to nuxt/nuxt#14790? Note: the current wrapper matches the documentation there: https://nodejs.org/docs/latest-v16.x/api/packages.html#approach-1-use-an-es-module-wrapper |
Ok. Let's keep this issue open for the time being. It's possibly a Nuxt issue (which now uses jiti, which contains a bit more context unjs/jiti#87). ReproductionInstall nuxt3 latest (rc12) with The way to reproduce is, inside a minimal Nuxt project, create a module, say "lib/module.js", use the following config: export default defineNuxtConfig({
modules: [ './lib/module.js']
build: {
// transpile: ['engine.io'] // doesn't help
}
}) Inside "./lib/module.js": import { Server } from 'socket.io'
console.log(Server) // should print to the console
ResultTypeError: Cannot destructure property 'Server' of '_engineIo.default' |
I have the same problem with nuxt stable version. Is there any way currently to work around this problem? |
I did a research, so far I've seen none. |
The package does not have a default export, so importing it from a project using ES modules would break in some cases. > Cannot destructure property 'Server' of '_engineIo.default' Related: #657
Describe the bug
A clear and concise description of what the bug is.
In a library I've written, when I attempt to import from "socket.io", I encounter an error "TypeError: Cannot destructure property 'Server' of '_engineIo.default'. I am able to fix this by updating the first line in wrapper.mjs:
Please let me know if you'd be open to the proposed change. I can submit the PR if you'd like.
Linked issue: https://github.com/richardeschloss/nuxt-socket-io/issues/278
The text was updated successfully, but these errors were encountered: