Support SSR in plugin-vue-jsx
See original GitHub issueDescribe the bug
Vite is unable to SSR when using jsx/tsx style Vue components. I have been told by a Vue maintainer this is is because @vite/plugin-vue-jsx
is failing to inject modules into ssr context. Please see original issue for more context
Reproduction
Please provide a link to a repo that can reproduce the problem you ran into.
https://github.com/seanaye/vue3-tsx-tailwind
- clone
yarn
yarn dev
- open localhost:3000
Cannot read property forEach of undefined
I previously assumed this error came from renderToString
from @vue/server-renderer
, see line 16 of entry-server.ts
. Apparently this comes from the jsx plugin not injecting modules into ssr context.
System Info
vite
version: 2.0.0 beta 65- Operating System: Mac OS Big Sur M1 Chip
- Node version: 15.3.0
- Package manager (npm/yarn/pnpm) and version: yarn 1.22.10
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Server-Side Rendering (SSR) - Vue.js
Vite provides built-in support for Vue server-side rendering, but it is intentionally low-level. If you wish to go directly with Vite, check out...
Read more >Server-Side Rendering - Vite
Vite provides built-in support for server-side rendering (SSR). The Vite playground contains example SSR setups for Vue 3 and React, which can be...
Read more >ssr-plugin-vue - npm
Start using ssr-plugin-vue in your project by running `npm i ... There are no other projects in the npm registry using ssr-plugin-vue.
Read more >vite-plugin-ssr
With vite-plugin-ssr you integrate tools manually; while it means more work, it gives you a fundamentally simpler & more stable foundation to build...
Read more >Creating Server-side Rendered Vue.js Apps Using Nuxt.js
Nuxt.js is based off an implementation of SSR for the popular React library called Next. After seeing the advantages of this design, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think I will try my hand at a PR for this tomorrow. Would love to contribute to such an awesome project
@yyx990803 I think it’s getting very close. Using with the latest vite core gives following error. Maybe this is a vue-router issue now and not a vite one?