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 left-hand binding in function parameter list." Occurs in versions after v3.3.5 #9493

Closed
Mini-ghost opened this issue Oct 28, 2023 · 2 comments · Fixed by #9495
Closed
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. has workaround A workaround has been found to avoid the problem regression scope: compiler

Comments

@Mini-ghost
Copy link
Contributor

Mini-ghost commented Oct 28, 2023

Vue version

3.3.7

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-w2khku?file=src%2FApp.vue

Steps to reproduce

  1. Open reproduce.
  2. An error message is displayed:
截圖 2023-10-28 上午11 30 27

What is expected?

The code reproduces correctly in v3.3.4, and I'm not entirely sure what might be causing the error to appear in versions after v3.3.5, including 3.4.0-alpha.1. If there's a particular reason for this behavior, I would greatly appreciate your insights."

What is actually happening?

Vite display the following error message:

[plugin:vite:vue] Binding invalid left-hand side in function parameter list. (1:1)
/home/projects/vitejs-vite-w2khku/src/App.vue:1:1
1  |  <script setup lang="ts">
   |   ^
2  |  import Loop from './components/Loop.vue';
3  |
    at constructor (file:///home/projects/vitejs-vite-w2khku/node_modules/.pnpm/@babel+parser@7.23.0/node_modules/@babel/parser/lib/index.js:356:19)
    at TypeScriptParserMixin.raise (file:///home/projects/vitejs-vite-w2khku/node_modules/.pnpm/@babel+parser@7.23.0/node_modules/@babel/parser/lib/index.js:3223:19)
    at TypeScriptParserMixin.checkLVal (file:///home/projects/vitejs-vite-w2khku/node_modules/.pnpm/@babel+parser@7.23.0/node_modules/@babel/parser/lib/index.js:7443:12)
    at TypeScriptParserMixin.checkParams (file:///home/projects/vitejs-vite-w2khku/node_modules/.pnpm/@babel+parser@7.23.0/node_modules/@babel/parser/lib/index.js:11973:12)
    at TypeScriptParserMixin.eval (file:///home/projects/vitejs-vite-w2khku/node_modules/.pnpm/@babel+parser@7.23.0/node_modules/@babel/parser/lib/index.js:11948:14)
    at TypeScriptParserMixin.parseBlockOrModuleBlockBody (file:///home/projects/vitejs-vite-w2khku/node_modules/.pnpm/@babel+parser@7.23.0/node_modules/@babel/parser/lib/index.js:13210:56)
    at TypeScriptParserMixin.parseBlockBody (file:///home/projects/vitejs-vite-w2khku/node_modules/.pnpm/@babel+parser@7.23.0/node_modules/@babel/parser/lib/index.js:13187:10)
    at TypeScriptParserMixin.parseBlock (file:///home/projects/vitejs-vite-w2khku/node_modules/.pnpm/@babel+parser@7.23.0/node_modules/@babel/parser/lib/index.js:13175:10)
    at TypeScriptParserMixin.parseFunctionBody (file:///home/projects/vitejs-vite-w2khku/node_modules/.pnpm/@babel+parser@7.23.0/node_modules/@babel/parser/lib/index.js:11940:24)
    at TypeScriptParserMixin.parseArrowExpression (file:///home/projects/vitejs-vite-w2khku/node_modules/.pnpm/@babel+parser@7.23.0/node_modules/@babel/parser/lib/index.js:11915:10

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.4.2 - /usr/local/bin/npm
    pnpm: 8.9.2 - /usr/local/bin/pnpm
  npmPackages:
    vue: ^3.3.7 => 3.3.7

Any additional comments?

N/A

@edison1105 edison1105 added scope: compiler ❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. regression labels Oct 28, 2023
@edison1105
Copy link
Member

related to https://github.com/vuejs/core/pull/8538/files

@haoqunjiang
Copy link
Member

Workaround: use a helper function

const getLoopSlotName = (item) => `item:${item.key}`;
<Loop :items="items">
  <template
    v-for="item in items"
    :key="item.key"
    #[getLoopSlotName(item)]="{ value }"
  >
    {{ value }}
  </template>
</Loop>

@haoqunjiang haoqunjiang added has workaround A workaround has been found to avoid the problem ❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. and removed ❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. labels Nov 3, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Nov 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. has workaround A workaround has been found to avoid the problem regression scope: compiler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants