Skip to content
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

Vue 3 Object(...) is not a function #528

Open
ReazerDev opened this issue May 6, 2021 · 13 comments
Open

Vue 3 Object(...) is not a function #528

ReazerDev opened this issue May 6, 2021 · 13 comments

Comments

@ReazerDev
Copy link

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.
image
When I remove the Decorator, the TypeError is gone.

Also when running npm run serve, I get a warning:
image

@jnt0r
Copy link
Contributor

jnt0r commented May 12, 2021

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.

@jnt0r
Copy link
Contributor

jnt0r commented May 12, 2021

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 #489 (comment)

@probil
Copy link
Owner

probil commented May 13, 2021

@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?

@ReazerDev
Copy link
Author

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.

@ReazerDev
Copy link
Author

image
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"

@probil
Copy link
Owner

probil commented May 15, 2021

@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?

@ReazerDev
Copy link
Author

I'm using babel

@jnt0r
Copy link
Contributor

jnt0r commented May 15, 2021

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?

@ReazerDev
Copy link
Author

I'll push the repo to Github and post a link here, once I'm home👍

@ReazerDev
Copy link
Author

https://github.com/ReazerDev/vue-3-socket-io-demo

@jnt0r
Copy link
Contributor

jnt0r commented May 16, 2021

@ReazerDev got your repo working. Just updated the dependencies to the newest ones. Especially the ones with "@vue/...".

@ReazerDev
Copy link
Author

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?

@jnt0r
Copy link
Contributor

jnt0r commented Jul 15, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants