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

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

Closed
TelephoneTan opened this issue Jan 14, 2023 · 1 comment · Fixed by #7536
Closed

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

TelephoneTan opened this issue Jan 14, 2023 · 1 comment · Fixed by #7536
Labels
has PR A pull request has already been submitted to solve the issue scope: compiler

Comments

@TelephoneTan
Copy link

TelephoneTan commented Jan 14, 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:

if (defaultExport.declaration.type === 'ObjectExpression') {
optionProperties = defaultExport.declaration.properties
} else if (
defaultExport.declaration.type === 'CallExpression' &&
defaultExport.declaration.arguments[0].type === 'ObjectExpression'
) {
optionProperties = defaultExport.declaration.arguments[0].properties
}

this line:

defaultExport.declaration.arguments[0].type === 'ObjectExpression'

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

sxzz added a commit that referenced this issue Jan 15, 2023
sxzz added a commit that referenced this issue Jan 26, 2023
sxzz added a commit that referenced this issue Jan 29, 2023
sxzz added a commit that referenced this issue Jan 29, 2023
sxzz added a commit that referenced this issue Feb 1, 2023
sxzz added a commit that referenced this issue Feb 4, 2023
@haoqunjiang haoqunjiang added scope: compiler has PR A pull request has already been submitted to solve the issue labels Mar 15, 2023
sxzz added a commit that referenced this issue Mar 27, 2023
sxzz added a commit that referenced this issue Mar 28, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has PR A pull request has already been submitted to solve the issue scope: compiler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants