Skip to content

when use custom v-model (with <script setup> style),it goes well in dev env,but may occur error:modelValue is undefined in production env #5584

Closed
@CherishTheYouth

Description

@CherishTheYouth

Version

3.2.31

Reproduction link

gitee.com

Steps to reproduce

(1)create a vue3 project with vite;
(2)write a parent component and a child component in <script setup>, use v-model for parent child component communication;
(3)it goes well in dev env,but occur error in prod env, the error as follows:

    index.8d23215e.js:1 Uncaught ReferenceError: modelValue is not defined
    at HTMLInputElement.u.onUpdate:modelValue.l.<computed>.l.<computed> [as _assign] (index.8d23215e.js:1)
    at HTMLInputElement.<anonymous> (vendor.52e08146.js:1)

What is expected?

I expect that my vue3 project which structured by vite.js will go well when use v-model write in <script setup> in prod dev.

What is actually happening?

Actually, it goes well in dev env but get the follow error in prod dev:

  index.8d23215e.js:1 Uncaught ReferenceError: modelValue is not defined
    at HTMLInputElement.u.onUpdate:modelValue.l.<computed>.l.<computed> [as _assign] (index.8d23215e.js:1)
    at HTMLInputElement.<anonymous> (vendor.52e08146.js:1)

NOTE:when I write it not in <script setup>, this error won't happen;
KeyWord:

  • vite
  • v-model (custom component)
  • in <script setup>
  • production env

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions