Subscribe on changes!

`Invalid assignment target` in v-model data binding when building for production

avatar
May 13th 2023

Vue version

3.3.2

Link to minimal reproduction

https://github.com/DamianGlowala/nuxt-invalid-asignment-target-repro

Steps to reproduce

  1. npm install
  2. npm run build

What is expected?

Project successfully building for production.

What is actually happening?

image

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (16) x64 12th Gen Intel(R) Core(TM) i5-12600K
    Memory: 1.14 GB / 15.80 GB
  Binaries:
    Node: 20.1.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 9.6.4 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.1635.0), Chromium (112.0.1722.46)
    Internet Explorer: 11.0.22621.1

Any additional comments?

It works fine in development.

avatar
May 13th 2023

It seems that the

v-model:is-open="
   isWatchYouTubeEmployerTalkVideoModalOpen
"

should be changed to

v-model:is-open="isWatchYouTubeEmployerTalkVideoModalOpen"
avatar
May 13th 2023

This is how Prettier formats my code and there should be no issue with that. Notice how lengthy the variable name is (hence splitting into a separate line). The latter example you included is indeed what I need to do manually to build the application.

This looks like an edge case that only fails in a specific situation. Modyfing the code slightly (e.g. removing some elements) will make this error disappear, but I still see no reason for it to fail in the included reproduction.

avatar
Nov 16th 2023

I had the same problem. This problem seems to occur when the character constant used to specify the variable name contains spaces.

avatar
Nov 23rd 2023

I had the same problem when building nuxt in production. This error appears only with ref-value variables. When using reactive variable there is no error.

avatar
Feb 8th 2024

I have the same problem as well. I don't concider changing code format to one line as a fix as this would be very unstable solution. Who is responsible for this issue, is it esbuild or vite directly?