wheatjs / vite-plugin-vue-type-imports

Import types in Vue SFC for defineProps
223 stars 17 forks source link

use withDefaults error #11

Closed P-Mz closed 2 years ago

P-Mz commented 2 years ago

image

https://stackblitz.com/edit/vitejs-vite-9mc6hi?file=src%2Fcomponents%2FHelloWorld.vue

Zolyn commented 2 years ago

The plugin does not replace imported variables, which is not its job. You will get the same error even if you disable this plugin. I think this should be a feature request.

Zolyn commented 2 years ago

You can just change defaultProps to { ...defaultProps } to force Vue to fallback to runtime merging

Otherwise, you can install a plugin to do this automatically for you.

vite-plugin-vue-with-defaults-imports