Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid assignment target in v-model data binding with type assertion when building for production #409

Open
kingyue737 opened this issue Dec 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@kingyue737
Copy link
Contributor

Environment

https://stackblitz.com/edit/github-4n1bjaud

Reproduction

  1. Add type assertion in v-model, for example, v-model="foo as any"
  2. npm run build

Describe the bug

Error during build:
image

According to the maintainer of vue vuejs/core#12620 (comment), it may be an issue of unimport. There is no error if ref is imported explicitly

Additional context

No response

Logs

No response

@kingyue737 kingyue737 added the bug Something isn't working label Dec 27, 2024
@noootwo
Copy link
Contributor

noootwo commented Jan 8, 2025

I do some research, I set a breakpoint during unimport initialization, but it never reached the breakpoint before the program crashed.This error is threw by esbuild, before unimport do anything.

When the ref is not be imported, vue will analysis the data as the setup-maybe-ref, so the result with error will be generated.
So, vue team think unimport should import ref before vue compilation, see vuejs/core#12620.

I try to set the unimport plugin option enforce as 'pre', but the same error occurs.
I think this issue is also related to the packaging process of nuxt, WDYT? @antfu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants