Subscribe on changes!

Vue typescript export module error

avatar
Sep 16th 2022

Vue version

3.2.39

Link to minimal reproduction

https://github.com/amm834/vue-supabase-workout-app/tree/cf722cadc965fe5d8f23a83b077eaca274f63afa

Steps to reproduce

Clone that repo and

See:

vite.config.ts

https://github.com/amm834/vue-supabase-workout-app/blob/cf722cadc965fe5d8f23a83b077eaca274f63afa/vite.config.ts

https://github.com/amm834/vue-supabase-workout-app/blob/cf722cadc965fe5d8f23a83b077eaca274f63afa/vite.config.ts

https://github.com/amm834/vue-supabase-workout-app/blob/cf722cadc965fe5d8f23a83b077eaca274f63afa/src/views/Home.vue#L12

What is expected?

Error must be resolved.

What is actually happening?

Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/@supabase_supabase-js.js?v=dfd7ae95' does not provide an export named 'Session' (at auth.ts:3:9)

System Info

System:
    OS: Windows 10 10.0.22000
    CPU: (4) x64 Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
    Memory: 1.08 GB / 7.66 GB
  Binaries:
    Node: 16.15.1 - C:\Program Files\nodejs\node.EXE
    npm: 8.11.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (105.0.1343.42)
    Internet Explorer: 11.0.22000.120
  npmPackages:
    vue: ^3.2.38 => 3.2.39

Any additional comments?

It seems vite and esbuild error. But I just decided to open that at here cuz you guy are same in fact

avatar
Sep 17th 2022

This is not related to Vue core. My recommendation would be to join the Vite discord and ask the Vite community how do deal with this error.

https://discord.gg/4Hq8uzDy

avatar
Sep 17th 2022

Thanks I will do it

avatar
Sep 17th 2022

Sorry, I just forgot the typescript version and to check the vite doc. I just fixed that bug by using type-only import that was introduced in typescript version 3.8.

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export

import type {Session} from "@supabase/supabase-js";