[Vuejs]-Vue3.js and exported namespace

0👍

You cannot move code from TS files into script setup by this exact reason –
You can’t use export in Script Setup

That’s the whole reason to use TS rather then just using Script Setup

The only thing Script Setup can export is the implicit default export of the whole component

If you want a namespace export, use TS file

If you want a namespace of components, import components as defaults from .vue and reexport into namespace

👤Dimava

1👍

In your code, you are trying to export a namespace (myNS) and import from an external package. does not support these features directly. To resolve this issue, you can consider the following approaches: Use Block: If you need to export a namespace or use advanced ES module features, it might be best to use a regular block instead of .

<script lang="ts">
import { Stuffs } from "package";

export namespace myNS {
  // members here
}
</script>

Leave a comment