unplugin / unplugin-vue

✨ Transform Vue 3 SFC to JavaScript. Supports Vite, esbuild, Rollup, Webpack and more.
MIT License
175 stars 7 forks source link

Non-descriptive errors with esbuild #149

Closed mcrampon closed 9 months ago

mcrampon commented 9 months ago

Describe the bug

When using unplugin-vue with esbuild, I get error messages that I can't really use.

image

From what I could diagnose, this comes from this line: https://github.com/unplugin/unplugin-vue/blob/d17f4dcc3bc511d0deb43dd0d372fffdb21fa0b6/src/core/template.ts#L106

I would guess that esbuild doesn't really do anything with objects here and would rather get a string

Reproduction

unplugin-vue 5.0.2 + esbuild 0.20.0

Example of a component that will produce such an error:

<template>
  <MyComponent v-model="myProp" />
</template>
<script>
export default {
  props: {
    myProp: {
      type: String,
      required: true
    }
  }
};
</script>

The error message should be something like:

  SyntaxError: v-model cannot be used on a prop, because local prop bindings are not writable.
  Use a v-bind binding combined with a v-on listener that emits update:x event instead.

System Info

System:
    OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
    CPU: (16) x64 AMD Ryzen 7 PRO 5850U with Radeon Graphics
    Memory: 1.23 GB / 11.50 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 18.19.0 - ~/.nvm/versions/node/v18.19.0/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v18.19.0/bin/yarn
    npm: 10.2.3 - ~/.nvm/versions/node/v18.19.0/bin/npm
  Browsers:
    Chrome: 120.0.6099.129

Used Package Manager

yarn

Validations

sxzz commented 9 months ago

Fixed!

sxzz commented 9 months ago

Try unplugin-vue@5.0.3