mrTimofey / vue-ssr-starter

Starter kit for projects with Webpack 4, Vue 2 and SSR
53 stars 15 forks source link
axios buble pug server-side-rendering ssr stylus svg-sprites vue vue-router vuex webpack

Webpack, Vue, SSR project template

Includes:

Getting started

npm i

# development server on localhost:8080
npm run dev

# production build
npm run build

# production server on localhost:8080
npm start

Configuration

.env.dev contains environment variables used for local development. You can change application port, API base URL for server and client and enable/disable proxy (http-proxy-middleware).

For production builds you should provide same environment variables yourself. Alternatively you can use .env after these steps:

  1. Move dotenv from devDependencies to dependencies.
  2. Create .env file with production config.
  3. Run npm start or NODE_ENV=production node -r dotenv/config index.

API proxy

See setup-proxy.js for description.

Application structure

SSR related component features

Every component within src/pages directory can use some special features providing full SSR support:

prefetch also works on the root component (src/app.vue) with some restrictions: