vitejs / vite-plugin-vue

Vite Vue Plugins
MIT License
500 stars 154 forks source link

Unable to locate the error file line number of v-on #405

Open axolo opened 6 months ago

axolo commented 6 months ago

Related plugins

Describe the bug

Unable to locate the error file line number of v-on.

no semicolon and no arrow function, like:

<my-dialog
  @close="
    show = false
    id = ''
  "
/>

output:

error during build:
SyntaxError: Error parsing JavaScript expression: Unexpected token, expected "," (3:0)
    at createCompilerError (D:\my-project\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:1329:17)
    at emitError (D:\my-project\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:2822:5)
    at createExp (D:\my-project\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:2815:7)
    at Object.onattribend (D:\my-project\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:2336:29)
    at Tokenizer.handleInAttrValue (D:\my-project\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:909:16)
    at Tokenizer.stateInAttrValueDoubleQuotes (D:\my-project\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:919:10)
    at Tokenizer.parse (D:\my-project\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:1063:16)
    at Object.baseParse (D:\my-project\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:2861:13)
    at Object.parse (D:\my-project\node_modules\@vue\compiler-dom\dist\compiler-dom.cjs.js:707:23)
    at Object.parse$2 [as parse] (D:\my-project\node_modules\@vue\compiler-sfc\dist\compiler-sfc.cjs.js:1853:24)

Reproduction

see Describe

Steps to reproduce

No response

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (8) x64 Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
    Memory: 5.74 GB / 15.76 GB
  Binaries:
    Node: 22.1.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (123.0.2420.97)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    @vitejs/plugin-legacy: ^5.3.1 => 5.3.2 
    @vitejs/plugin-vue: ^5.0.4 => 5.0.4 
    vite: ^5.1.4 => 5.2.11

Used Package Manager

npm

Logs

see Describe

Validations