DEV Community

How to Perform Pre-rendering in Vue CLI 3?

Aashay Trivedi on October 08, 2019

Single page apps are awesome. Developing single-page apps with frameworks like angular, react or vue make your app more user-friendly. Along with t...
Collapse
 
anwar_nairi profile image
Anwar

Great article Aashay, I waited so long for someone to open this topic, thought I was alone trying to perform prerendering!

Did you put your prerendered pages on another location than your SPA? I am redirecting bots to prerender.mywebsite.com so far, I wanted to have your view on this. Knowing I made a custom prerendering tool (using puppeteer as well).

Collapse
 
aashay_trivedi profile image
Aashay Trivedi • Edited

Thank you very much for reading this article. No, I have not put my pre-rendered pages to the other location. I just generated build with "npm run build" and then it created a dist folder, inside of the dist folder it created individual HTMl files for each route.

I think you can deploy the dist folder anywhere and it will work fine. Only thing you should remember is that install NPM packages which are inside of the Package.json.

Collapse
 
kanedimaria profile image
kanedimaria

During an epidemic season like this, what do you generally do? smash karts which I recently found, is a fantastic game to play throughout the winter months. I'd like to invite you to join me right now.

Collapse
 
ricky11 profile image
Rishi U

Nice article

Cannot you run this on a static server like an s3 bucket, instead of a ubuntu server? isn't it still a serverless spa that is pre-rendered

The package was written by Chris Fritz i believe, unfortunately he no longer maintains the package and it is running a little stale now. What are other options? Can this package be added to an existing vue cli 3 project?

thanks

Collapse
 
garretthensley profile image
Garrett Hensley

I do this, but all of my folders contain the same index.html where it says javascript must be enabled

Collapse
 
aashay_trivedi profile image
Aashay Trivedi

This might not work on localhost, you need to deploy your code on the server.

Collapse
 
aricjoshua profile image
aricjoshua

I have installed and tested it, all is very smooth cookie clicker

Collapse
 
adamcassidy profile image
Adam Cassidy

Also, the Youtuber; Ben Awad, says pre-rendering is iffy for sites that are updated frequently: youtube.com/watch?v=xTsYYxf2Ut0 . Thanks for the article!

Collapse
 
chinachin profile image
chinachin

I have successfully installed, thank you! word counter