FranckFreiburger / vue3-sfc-loader

Single File Component loader for Vue2 and Vue3. Load .vue files directly from your HTML. No node.js environment, no build step.
MIT License
1.03k stars 116 forks source link

Error parse script on defineProps #131

Closed jfrank14 closed 5 months ago

jfrank14 commented 2 years ago

I'm trying to run the SFC loader on the out of the box application generated by vue. This app has an App.vue that references a component HelloWorld.vue that does this:

<script setup lang="ts">
defineProps<{
  msg: string
}>()
</script>

When I do this, I get the following error in the browser:

error parse script /vue/src/components/HelloWorld.vue
  4 |   props: {
  5 |     msg: { type: String, required: true }
> 6 |   } as unknown as undefined,
    |     ^ Unexpected token, expected "," (6:4)
  7 |   setup(__props: {
  8 |   msg: string
  9 | }, { expose }) {

Does the parser not know how to handle the new defineProps syntax?