Subscribe on changes!

"export default" within Vue component srcipt causes index-out-of-range

avatar
Jan 14th 2023

Vue version

3.2.45

Link to minimal reproduction

https://github.com/TelephoneTan/vuejs-core-issue-7534

Steps to reproduce

Run npm i followed by npm run dev.

What is expected?

everything ok

What is actually happening?

compile error

System Info

  System:
    OS: Windows 10 10.0.22623
    CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
    Memory: 4.58 GB / 31.89 GB
  Binaries:
    Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.1.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.1095.0), Chromium (107.0.1418.42)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    vue: ^3.2.45 => 3.2.45

Any additional comments?

error comes from here:

https://github.com/vuejs/core/blob/4c6176d1c46ddca606364815cff3d3ec5639685d/packages/compiler-sfc/src/compileScript.ts#L1064-L1071

this line:

https://github.com/vuejs/core/blob/4c6176d1c46ddca606364815cff3d3ec5639685d/packages/compiler-sfc/src/compileScript.ts#L1068

If the function call has no arguments, arguments[0].type would be an error.