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

[Question] it can't work with unplugin-vue2-script-setup #22

Open
moliyu opened this issue Nov 8, 2021 · 6 comments
Open

[Question] it can't work with unplugin-vue2-script-setup #22

moliyu opened this issue Nov 8, 2021 · 6 comments
Labels
question Further information is requested

Comments

@moliyu
Copy link

moliyu commented Nov 8, 2021

image
image
image

@JuniorTour
Copy link
Owner

JuniorTour commented Nov 8, 2021

It is a bug.

This lib may have something wrong with unplugin-vue2-script-setup || vue-composition-api.

unplugin-vue2-script-setup && vue-composition-api works fine with this compiler.

See https://github.com/JuniorTour/vue-template-babel-compiler-VueUse-Example

I will look into it and fix it ASAP.

Thanks for your feedback.


If anyone has interest to fix this issue, you can:

  1. Try to reproduce this code snippet and error by setup DEMO Project.

  2. Follow CONTRIBUTING.md to make a contribution.

@JuniorTour JuniorTour added bug Something isn't working contribution welcome Good for newcomers labels Nov 8, 2021
@JuniorTour
Copy link
Owner

JuniorTour commented Nov 14, 2021

Do you use VueCompositionAPI?

I found the unplugin-vue2-script-setup && vue-composition-api works fine with this compiler.

But if you forget to write Vue.use(VueCompositionAPI) , there will be the same undefined error as yours.

So try to add these to your main.ts:

// main.ts || .js
import VueCompositionAPI from '@vue/composition-api'
Vue.use(VueCompositionAPI)

145e0cc8ba9759f75f1c0461ecc59ca

If your issue is still not resolved. Just let me know.

@moliyu
Copy link
Author

moliyu commented Nov 15, 2021

image
it can not work for me.
here is my package.json

{
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "dev": "vue-cli-service serve",
    "build": "vue-cli-service build"
  },
  "dependencies": {
    "@vue/composition-api": "^1.3.3",
    "@vueuse/core": "^6.7.6",
    "vue": "^2.6.14"
  },
  "devDependencies": {
    "@vue/cli-plugin-typescript": "^4.5.13",
    "@vue/cli-service": "^4.5.13",
    "@vue/runtime-dom": "^3.2.21",
    "typescript": "^4.3.5",
    "unplugin-vue2-script-setup": "^0.6.13",
    "vue-template-babel-compiler": "^1.0.6-0",
    "vue-template-compiler": "^2.6.14"
  }
}

@moliyu
Copy link
Author

moliyu commented Nov 16, 2021

@JuniorTour it works fine with latest @vue/composition-api

@moliyu
Copy link
Author

moliyu commented Nov 16, 2021

thank you

@JuniorTour
Copy link
Owner

I also made an Example project for vue-template-babel-compiler && VueUse && unplugin-vue2-script-setup && vuejs/composition-api

See https://github.com/JuniorTour/vue-template-babel-compiler-VueUse-Example

92df1606f5d2a510acdb4b8d41742cb

@JuniorTour JuniorTour changed the title it can't work with unplugin-vue2-script-setup [Fixed Bug] it can't work with unplugin-vue2-script-setup Nov 22, 2021
@JuniorTour JuniorTour added question Further information is requested and removed bug Something isn't working contribution welcome Good for newcomers labels Nov 22, 2021
@JuniorTour JuniorTour changed the title [Fixed Bug] it can't work with unplugin-vue2-script-setup [Question] it can't work with unplugin-vue2-script-setup Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants