vue-socket.io-extended
vue-socket.io-extended copied to clipboard
Vue 3 Object(...) is not a function
Hi, I'm using alpha5 and when I'm trying to use the Socket Decorator I get a TypeError in the function beneath it:
Object(...) is not a function
.
When I remove the Decorator, the TypeError is gone.
Also when running npm run serve, I get a warning:
Are you sure you're using alpha5? Newest I can found is alpha4. And there everything is working for me using @Socket Decorator. Maybe you could provide some more context of your code. The first thing I would think of is the import of Socket. Maybe it's not correct.
Okay, I need to correct my comment. Got the warning on compile-time too. Remembered that there were some breaking changes in alpha stated here https://github.com/probil/vue-socket.io-extended/issues/489#issuecomment-771497973
@ReazerDev In v5 decorator is supposed to be imported from the sub-path:
import { Socket } from 'vue-socket.io-extended' // v4
import Socket from 'vue-socket.io-extended/decorator' // v5
could you check whether it works this way?
Are you sure you're using alpha5? Newest I can found is alpha4. And there everything is working for me using @socket Decorator. Maybe you could provide some more context of your code. The first thing I would think of is the import of Socket. Maybe it's not correct.
Nope I've been using alpha-4. I'm updating to alpha-5 now.
Now I get this error when compiling.
This is how I import Socket:
import Socket from 'vue-socket.io-extended/decorator';
VSCode doesn't throw any errors and I can even Ctrl+Right-Click it and it finds the type definitions. I've deleted my node_modules folder and my package-lock.json.
This is in my package.json:
"vue-socket.io-extended": "^5.0.0-alpha.5"
@ReazerDev That's weird. How are use transpiling TS in vue files? With typescript or babel? Or maybe something more cutting edge, e.g. esbuild?
I'm using babel
I just updated to alpha.5 and it's working for me. Think I'm using babel too. @ReazerDev can you share a link to your repo or provide some snippets of your config?
I'll push the repo to Github and post a link here, once I'm home👍
https://github.com/ReazerDev/vue-3-socket-io-demo
@ReazerDev got your repo working. Just updated the dependencies to the newest ones. Especially the ones with "@vue/...".
Wait I think I just now realised, that you mean, that everything is working and not that you got my repo working and are starting to look what causes my issue?
No. I meant that I got your repo working by updating the dependencies. You need to update the dependencies with "@vue/..." to get your repo working.