question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SSR build for vue not output server side

See original GitHub issue

Expect:

  • Able to run yarn build and deploy using build output

Actual:

  • Serve dist will return a blank page

Logs

  • Start project using command npm init capri demo-capri -- -e vue
  • Run yarn build
yarn build
yarn run v1.22.19
$ vite build && vite build --ssr
vite v2.9.13 building for production...
βœ“ 40 modules transformed.
dist/assets/capri.ce1c56b3.svg                     1.38 KiB
dist/preview/index.html                            1.02 KiB
dist/index.html                                    0.65 KiB
dist/ssr-manifest.json                             2.74 KiB
dist/assets/index.12a53772.js                      0.23 KiB / gzip: 0.16 KiB
dist/assets/hydrate.09f2daa6.js                    2.06 KiB / gzip: 0.96 KiB
dist/assets/plugin-vue_export-helper.21dcd24c.js   0.09 KiB / gzip: 0.10 KiB
dist/assets/Counter.island.d5166a1f.js             0.49 KiB / gzip: 0.34 KiB
dist/assets/Expandable.island.718a2566.js          0.81 KiB / gzip: 0.52 KiB
dist/assets/MediaQuery.island.fe4d450c.js          0.38 KiB / gzip: 0.29 KiB
dist/assets/Counter.island.9a7e7aed.css            0.05 KiB / gzip: 0.07 KiB
dist/assets/main.beb4e855.css                      0.75 KiB / gzip: 0.43 KiB
dist/assets/main.e47b13dd.js                       24.83 KiB / gzip: 10.35 KiB
dist/assets/Expandable.island.e8e34690.css         0.31 KiB / gzip: 0.20 KiB
dist/assets/runtime-dom.esm-bundler.19cc2f9d.js    59.27 KiB / gzip: 23.58 KiB
vite v2.9.13 building SSR bundle for production...
βœ“ 20 modules transformed.
dist/main.server.js   18.57 KiB
✨  Done in 2.70s.
  • Check output
dist
β”œβ”€β”€ assets
β”‚  β”œβ”€β”€ capri.ce1c56b3.svg
β”‚  β”œβ”€β”€ Counter.island.9a7e7aed.css
β”‚  β”œβ”€β”€ Counter.island.d5166a1f.js
β”‚  β”œβ”€β”€ Expandable.island.718a2566.js
β”‚  β”œβ”€β”€ Expandable.island.e8e34690.css
β”‚  β”œβ”€β”€ hydrate.09f2daa6.js
β”‚  β”œβ”€β”€ index.12a53772.js
β”‚  β”œβ”€β”€ main.beb4e855.css
β”‚  β”œβ”€β”€ main.e47b13dd.js
β”‚  β”œβ”€β”€ MediaQuery.island.fe4d450c.js
β”‚  β”œβ”€β”€ plugin-vue_export-helper.21dcd24c.js
β”‚  └── runtime-dom.esm-bundler.19cc2f9d.js
β”œβ”€β”€ index.html
β”œβ”€β”€ preview
β”‚  └── index.html
└── ssr-manifest.json

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
fgnasscommented, Jul 11, 2022

I’m currently working on proper SSR support in the next branch. The repo already contains two examples, one for Vercel and one for Cloudflare workers: https://github.com/capri-js/capri/tree/next/examples

For a simple Node server something like this should work:

import capri from "@capri-js/vue";
import react from "@vitejs/plugin-vue";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [
    vue(),
    capri({
      prerender: false, // can also be a function to selectively prerender pages
      target: {
        async build({ ssrBundle, fsutils }) {
          fsutils.copy(ssrBundle, "/path/to/somewhere.js");
        }
      },
    }),
  ],
});

0reactions
eric-burelcommented, Aug 15, 2022

Hey @fgnass, I’ve invited you to the repo. I was already using react-router-dom 6.3.0 so I don’t know what happens.

I am not stuck in anyway as I can restart from scratch but if you manage to reproduce the issues, this may help you figure out some bugs.

It’s private only because I was testing out Plasmic and not yet sure of which API key is public or not (the one in the repo is public according to Plasmic team), so feel free to reuse this code if you want to create a Plasmic starter.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Server-Side Rendering (SSR)
Vue.js is a framework for building client-side applications. By default, Vue components produce and manipulate DOM in the browser as output.
Read more >
How to Server Side Rendering (SSR) with Vue.js?
Vue instance is compiling on the server side with renderer function. Now, we create vue instance in express.
Read more >
vuejs/vue-cli - Implement SSR mode (server side rendering)
But when using vue-server-renderer it expect one entry file. So commonChunksPlugin should be disabled. Building for production.
Read more >
A Step-By-Step Guide to Server-Side Rendering with VueJS
Server -side rendering is proven for its performance, ... I will guide you through the process of server-side rendering (SSR) with VueJS.
Read more >
Basic Server Side Rendering with Vue.js and Express
Learn how to implement rudimentary server-side for your Vue.js apps. ... Server side rendering (SSR) is one of those things that's long beenΒ ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found