Subscribe on changes!

Prop type information lost when building

avatar
Apr 12th 2022

Version

3.2.32

Reproduction link

github.com

Steps to reproduce

  1. Create a component with a prop
  2. Build using vite build

What is expected?

The compiled component should store prop type information

I copied the component code to SFC playground, and this is the result
const __sfc__ = /*#__PURE__*/_defineComponent({
  props: {
    extraClass: { type: String, required: false, default: '' }
  },
  emits: ["close"],
  setup(__props, { emit }

) {
...

The prop has correct type information

What is actually happening?

This is the output for the same component, but built using vite
const _sfc_main = /* @__PURE__ */ defineComponent({
  props: {
    extraClass: { default: "" }
  },
  emits: ["close"],
  setup(__props, { emit }) {

The prop has lost all type information


The SFC playground is here

Going to the above reproduction link, the component in question can be found at src/components/modal/ModalComponent.vue

avatar
Apr 26th 2022

The type information is limited in the development phase, and the production package does not verify the type