export default {
  mode: 'universal',
  /*
  ** Headers of the page
  */
  head: {
    title: process.env.npm_package_name || '',
    meta: [
      { name: "referrer", content: "same-origin"},
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
    ],
    script: [
      {
        src: '/qrcode.js'
      }
    ]
  },
  telemetry: false,
  /*
  ** Customize the progress-bar color
  */
  loading: false,
  /*
  ** Global CSS
  */
  css: [
    '~/assets/css/common.css',
    { src: 'element-ui/lib/theme-chalk/index.css' }
  ],
  // router: {
  //   middleware: 'i18n'
  // },
  router: {
    middleware: 'i18n'
  },
  /*
  ** Plugins to load before mounting the App
  */
  plugins: [
    { src: '~plugins/element-ui', ssr: true },
    { src: '~plugins/set-DOMPurify.js', ssr: true },
    { src: '~plugins/baidu-map', ssr: false },
    '~/plugins/axios',
    '~/plugins/util',
    '~/plugins/i18n.js',
    '~/plugins/route.client.js'  // only in client side
  ],
  generate: {
    routes: ['/', '/about', '/zh_CN', '/zh_CN/about']
  },
  /*
  ** Nuxt.js dev-modules
  */
  buildModules: [
  ],
  /*
  ** Nuxt.js modules
  */
  modules: [
    // Doc: https://axios.nuxtjs.org/usage
    '@nuxtjs/axios',
    '@nuxtjs/proxy'
  ],
  /*
  ** Axios module configuration
  ** See https://axios.nuxtjs.org/options
  */
  axios: {

  },

  /*
  ** Build configuration
  */
  build: {
    vendor: ['element-ui'],  // 添加模块，配置只打包一次，减少应用bundle的体积
    extractCSS: { allChunks: true },
    babel: {
      plugins: [
        ["component", { "libraryName": "element-ui", "styleLibraryName": "theme-chalk" }]
      ]
    },
    /*
    ** You can extend webpack config here
    */
    extend (config, ctx) {
    },
  }
}
