SSR generates wrong code
Vue version
3.2.37
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-vyjpyu?terminal=dev
Steps to reproduce
- Run
yarn build:server
- Open
dist/server/entry-server.js
- Search for
resolveComponent("nested-test")
(line 34) - Compare call of
ssrRenderSlot
(line 43):
ssrRenderSlot(_ctx.$slots, name, {}, null, _push2, _parent2, _scopeId); // <-- wrong: it should not be "name" but "_ctx.name" instead
- 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.
duplicate of https://github.com/vuejs/core/issues/7095