pikax/vue-composable

Module has no exported member

wojexe opened this issue · 11 comments

After importing import { useCssVariables } from "vue-composable" in the setup() function, accessing const { supported } = useCssVariables({}), program return this error: TS2305: Module '"../../../node_modules/vue-composable/dist/vue-composable"' has no exported member 'useCssVariables'.

I am using vue3 with TypeScript.

I have previously installed the package with npm install --save vue-composable and restarted the npm run serve afterwards.

vue-composable version: "^1.0.0-beta.18"

TS2305: Module '"../../../node_modules/vue-composable/dist/vue-composable"' has no exported member 'useCssVariables'.
    23 | <script lang="ts">
    24 | import { defineComponent, computed } from "vue";
  > 25 | import { useCssVariables } from "vue-composable";
       |          ^^^^^^^^^^^^^^^
pikax commented

Thank you for reporting, do you mind providing a repo?

I've tried on my vite playground but couldn't reproduce it

Sorry for the delay. I've created a repo simillar to the one I had problems with, and the issue persisted. Here's a link to download the repo archived in a zip file: https://file.io/VBvt7aiMBjSo

pikax commented

Sorry for the delay. I've created a repo simillar to the one I had problems with, and the issue persisted. Here's a link to download the repo archived in a zip file: https://file.io/VBvt7aiMBjSo

No worries, thank you, but it doesn't allow me to download it :D because the file has been deleted

Same happens for usei18n.
Just updated from 1.0.0-beta.11 to 1.0.0-beta.18

I am using vue3 with TypeScript.

pikax commented

Can you run node node_modules/vue-composable/scripts/postinstall.js on your project root folder? it might had an error installing the correct version

Sorry for the delay. I've created a repo simillar to the one I had problems with, and the issue persisted. Here's a link to download the repo archived in a zip file: https://file.io/VBvt7aiMBjSo

No worries, thank you, but it doesn't allow me to download it :D because the file has been deleted

Whoops. This link should work for 14 days from now on: http://transfer.sh/6GaVQ/vue-composable-repo.zip
Also, I forgot to notice, my working device runs is elementaryOS

Can you run node node_modules/vue-composable/scripts/postinstall.js on your project root folder? it might had an error installing the correct version

image
The problem persists for me after running postinstall.js manually

pikax commented

That is caused by typescript version, the supported version is typescript@4 and it's using ~3.9

Oh. So it was this trivial 😁️.
As for me, this typescript version was installed by default by vue-cli and it did not get updated once I've installed vue-composable; you may consider adding a disclaimer about the minimum typescript version required to the project's readme, so people won't encounted this problem in the future.
I'm closing the issue as my problem got solved. Thanks for help and keep up the great work ☺️

pikax commented

Just added, glad to see it fixed, I usually keep my typescript on the latest on all my projects.

@Herdismaria do you still have the same problem after updating to typescript@4?

No, that was the issue for me also. Thanks a lot for the help and for this awesome library 💯