Reference

Context

This object is sent to asyncData() function in your pages components, to onHttpRequest store action, to the exported src/main.js initialization function and to your defined middlewares.

Variable nameTypeDescription
appVue instanceThe main component of the application
routerVue router instanceRouter of the application. Official docs
storeVuex instanceVuex store. Official docs
routeRouteThe current route object. See: Route Object
paramsObjectAlias of route.params
queryObjectAlias of route.query
redirectFunctionSimple function to redirect to a specific page. Docs
errorFunctionSimple function to display an error page: Docs
urlStringURL of current page. SSR only
ctxKoa contextThe current koa context. See Koa website. SSR only

TIP

This variables are also accessible from this.$context in your components

Process variables

Thanks to Webpack and his DefinePlugin, this starter inject some useful variables in your project to handle some conditions based on build or environment context.

List of defined variables :

Variable nameDescription
process.devReturn true in development mode, false otherwise
process.testIs true if in test environment
process.prodReturn true in production mode, false otherwise
process.spaReturn true in SPA mode, false in SSR mode
process.ssrReturn true in SSR mode, false in SPA mode
process.clientIn SSR mode only: return true if in client rendering, false if in server side rendering
process.serverIn SSR mode only: return true if in server side rendering, false otherwise

TIP

For environment variables see the official Vue CLI documentation

Configuration

Theses configuration are in neue.config.js in your root project folder. Here is defaults values :

module.exports = {
  ssr: {
    server: null,
    directives: {},
    https: null,
    // See: https://ssr.vuejs.org/api/#shouldpreload
    shoudPrefetch: null,
    shoudPreload: null,
  },
  generate: {
    paths: [],
    scanRouter: true,
    params: {},
  },
  templatePath: 'src/index.html',
  paths: {
    main: '@/main',
    store: '@/store',
    router: '@/router',
  },
  css: {
    extract: false,
  },
  plugins: {},
};