Subscribe on changes!

SSR generates wrong code

avatar
Aug 19th 2022

Vue version

3.2.37

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-vyjpyu?terminal=dev

Steps to reproduce

  1. Run yarn build:server
  2. Open dist/server/entry-server.js
  3. Search for resolveComponent("nested-test") (line 34)
  4. Compare call of ssrRenderSlot (line 43):
ssrRenderSlot(_ctx.$slots, name, {}, null, _push2, _parent2, _scopeId); // <-- wrong: it should not be "name" but "_ctx.name" instead
  1. With call of renderSlot (line 48)
renderSlot(_ctx.$slots, _ctx.name),

What is expected?

Both calls should refer to variable name but actually the second renderer refers to _ctx.name which is different.

What is actually happening?

It does not work as expected because the variable is undefined.

System Info

System:
    OS: macOS 11.4
    CPU: (8) arm64 Apple M1
    Memory: 93.53 MB / 16.00 GB
    Shell: 3.5.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
    Yarn: 3.2.2 - ~/.nvm/versions/node/v16.15.0/bin/yarn
    npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm
  Browsers:
    Chrome: 104.0.5112.101
    Firefox: 100.0.1
    Safari: 14.1.1
  npmPackages:
    vue: 3.2.37 => 3.2.37

Any additional comments?

I downgraded to vue@3.2.25 as the lowest possible compatible version with the vite plugin but even there it didn't work.

avatar
Nov 29th 2022

@edison1105 great to hear 😊 will it be in the next release?

avatar
Nov 29th 2022

Nothing was fixed yet, this was just closed as a duplicate of another open issue.