-
Notifications
You must be signed in to change notification settings - Fork 7
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.x Composition API use
standard re-write
#2
Conversation
@NuroDev i have not used Vue 3.0 yet. Could you help me understand what the If possible, I would like to keep the |
I am by no means an expert at Vue 3.x by any means, but I have been using it a fair bit the past few weeks and I know that a common practice for plugins now (For example: // main.ts
import { createApp } from 'vue';
import { createStore } from 'vuex';
import App from './App.vue';
const store = createStore({
state () {
return {
count: 0,
}
},
mutations: {
increment (state) {
state.count++;
}
}
});
createApp(App)
.use(store)
.mount('#app'); <script lang="ts">
import { useStore } from 'vuex';
export default {
setup () {
const store = useStore();
console.log(store.count);
}
}
</script> From what I understand right now, though I could be wrong, one of the reason for the push to change to this "import a 'use' function" syntax is that it greatly aids in TypeScript support. Though there may of course be other, better reasons.
In theory this should still be the case. I sadly did not get a chance to test it yet, but in theory this line I added to app.config.globalProperties.$supabase = client_instance; |
@NuroDev I gave this a go today on a fresh Vue 3 project. Can't seem to get it running in JS (no typescript):
|
Not sure where that version came from?
Very odd. I have tested this myself (And even just tried creating a new Vue 3.x project, one in JS & another in TS, using vitejs and worked fine). My first guess seeing a EcmaScript module failure would be that probably the |
My test was with Webpack, so maybe that is the difference? |
Switching to ES6 didn't seem to help. Do you have any examples of libraries doing it the way you have setup? VueX etc all seem to be just written in JS, not TS. |
Unsure if this may be overkill for this library or not, but the popular Vue 3.x library Might be worth looking into that library a bit more then as it might mean we can publish a single version that is compatible with both versions. |
It would be amazing to be able to support both versions, as it simplifies the release process a lot. If you want to play around with that, feel free, and if not, hopefully, I can find some time over the next few days. |
Closing for #5 We still need to do the Typescript rewrite sometime. |
Building off #1