vite: Vue regression in 2.4.3

Describe the bug

This looks like a Vue or SFC compiler bug, but the only thing that changed (I double-checked by diffing package-lock.json) is Vite being upgraded from 2.4.1 to 2.4.3.

In 2.4.1 my app works fine.

In 2.4.3 it doesn’t start because of this error, straight in my root (App) component:

TypeError: Cannot destructure property 'Component' of 'undefined' as it is undefined.

Where it fails is this SFC generated code:

_createVNode(_component_router_view, null, {
        // Apparently at runtime this lambda receives undefined so destructuring fails
        default: _withCtx(({ Component, route }) => [
        // ...

Reproduction

My App.vue contains this template, which is the (first?) part that fails:

    <router-view v-slot="{ Component, route }">
      <suspense :key="route.path" v-else>
        <component :is="Component" />
        <template #fallback>Loading...</template>
      </suspense>
    </router-view>

System Info

System:
    OS: Windows 10 10.0.18363
    CPU: (12) x64 Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz
    Memory: 5.97 GB / 15.79 GB
  Binaries:
    Node: 15.5.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 7.3.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.18362.1593.0)
    Internet Explorer: 11.0.18362.1
  npmPackages:
    @vitejs/plugin-vue: ^1.2.4 => 1.2.4
    vite: ^2.4.2 => 2.4.3

Used Package Manager

npm

Logs

No response

Validations

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 26 (26 by maintainers)

Most upvoted comments

Given all the changes to dependency pre-bundling in 2.9, I think it is a good idea to close it now. As you said @jods4, it would be great if you find the time to test your project again. Please create a new issue against latest linking to this one if there is still an issue. Thanks!

Haven’t seen it in a while, I must admit. I’m soon gonna pick up work on the project that was problematic above, I’ll close the issue if it now works without issue.

@patak-js No, I did not try that.

Maybe it’ll help with the bug, but I shouldn’t need that if my npm list vue doesn’t show dupes, right?

@userquin It also works “as is”, without the props – you only need to restart Vite to make it work.

A missing prop in a component can’t cause Vite to serve 2 different versions of Vue at the same time, can it?

@patak-js I will. Now that I could work around the issue I need to get some work done but I’ll report later if that seems to be the culprit.