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

Broken inline comments within explicit undefined bindings #11216

Closed
barthy-koeln opened this issue Jun 24, 2024 · 0 comments · Fixed by #11217
Closed

Broken inline comments within explicit undefined bindings #11216

barthy-koeln opened this issue Jun 24, 2024 · 0 comments · Fixed by #11217

Comments

@barthy-koeln
Copy link

barthy-koeln commented Jun 24, 2024

Vue version

>=3.4.26 (worked fine until 3.4.25)

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-k1clft

Steps to reproduce

Have a property binding in a template that explicitly used the value undefined AND an inline comment:

<p :id="undefined /* force override the id */">This bugs out</p>

What is expected?

The value undefined is passed to the component or element.

What is actually happening?

The build fails with this error message:

error during build:
[vite:vue] Cannot read properties of null (reading 'type')
file: […]/src/components/TheComponent.vue
at […]/node_modules/@vue/compiler-dom/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js:4283:48
[…]

Or sometimes on Stackblitz:

[plugin:vite:vue] parent is null
/home/projects/vitejs-vite-k1clft/src/App.vue

System Info

No response

Any additional comments?

We use this to override specific properties passed using a v-bind. We pass undefined and add a comment why, as overriding something is mostly a workaround for a third-party-library.

<AComponent
  v-bind="CommonPropsObject"
  :specific-prop="undefined /* do not pass specificProp to avoid abc and xyz */"
/>

This is effectively equivalent to:

<AComponent
  v-bind="{
    ...CommonPropsObject,
    specificProp: undefined  /* do not pass specificProp to avoid abc and xyz */
  }"
/>
@LinusBorg LinusBorg added 🐞 bug Something isn't working scope: compiler regression and removed 🐞 bug Something isn't working labels Jun 25, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jul 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants