const pkg = require('./package')

module.exports = {
  mode: 'universal',

  env: {
    BASE_URL: process.env.BASE_URL
  },

  /**
   * 打包文件
   */
  build: {
    vendor: ['axios', 'element-ui']
  },

  server: {
    host: `0.0.0.0`,
    port: 3000,
  },

  /*
  ** Headers of the page
  */
  head: {
    title: '程序员客栈',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { name: 'baidu-site-verification', content: '7IbkIN9Kwp' },
      { 'http-equiv': 'X-UA-Compatible', content: 'IE=edge,chrome=1' },
      // hid: 'x', 可在页面内覆盖这里
      { name: 'robots', content: 'noindex,follow' },
      { name: 'description', content: pkg.description },
      { 'http-equiv': 'Cache-Control', content: 'no-transform' },
      { 'http-equiv': 'Cache-Control', content: 'no-siteapp' },
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },

  /*
  ** Customize the progress-bar color
  */
  loading: { color: '#fff' },

  /*
  ** Global CSS
  */
  css: [
    '@/assets/css/common.css',
    '@/assets/css/special.css',
  ],

  /*
  ** Plugins to load before mounting the App
  */
  plugins: [
    'plugins/common',
    'plugins/element',
    'plugins/http',
  ],
  /*
  ** Axios module configuration
  */
  axios: {
    // See https://github.com/nuxt-community/axios-module#options
    proxy: true
  },
  /**
   * Proxy
   */
  proxy: [
    ['/api', { target: 'https://dev.test.proginn.com', changeOrigin: true }],
    ['/image', { target: 'https://stacdn.proginn.com', changeOrigin: true }],
  ],

  /*
  ** Nuxt.js modules
  */
  modules: [
    '@nuxtjs/axios',
    '@nuxtjs/proxy',
  ],

  /*
  ** Build configuration
  */
  build: {
    /*
    ** You can extend webpack config here
    */
    extend(config, ctx) {

    }
  }
}
