'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.

const path = require('path')

module.exports = {

  // 网站模块名，例如 http://192.168.0.216:8089/module/app/initlayer.html 中的
  //【views】，默认为views，修改这里的配置的同时，也要同时重命名/src/views的这个文件夹名称
  // moduleName: 'zhongsteel.ytg', // http://localhost:8081/#/views/user.html
  //   apolloclear
  dev: {
    // Paths
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: {
      '/zhongsteel.pass.web/pass/v1': {
        target: 'http://172.16.90.238:8088/v1', //加http
        // target: 'http://192.168.10.191:9001/v1', //加http
        changeOrigin: true,
        pathRewrite: {
          '^/zhongsteel.pass.web/pass/v1': '/' //这里理解成用‘/api’代替target里面的地址，组件中我们调接口时直接用/api代替
          // 比如我要调用'http://0.0:300/user/add'，直接写‘/api/user/add’即可 代理后地址栏显示/
        }
      },
      '/zhongsteel.pass.web/pass/auth': {
        target: 'http://172.16.90.238:8088/auth', //加http
        // target: 'http://192.168.10.191:9001/auth', //加http
        changeOrigin: true,
        pathRewrite: {
          '^/zhongsteel.pass.web/pass/auth': '/' //这里理解成用‘/api’代替target里面的地址，组件中我们调接口时直接用/api代替
          // 比如我要调用'http://0.0:300/user/add'，直接写‘/api/user/add’即可 代理后地址栏显示/
        }
      },
      '/zhongsteel.pass.web/pass/logout': { 
        target: 'http://172.16.90.238:8088/logout', //加http
        changeOrigin: true,
        pathRewrite: {
          '^/zhongsteel.pass.web/pass/logout': '/' //这里理解成用‘/api’代替target里面的地址，组件中我们调接口时直接用/api代替
          // 比如我要调用'http://0.0:300/user/add'，直接写‘/api/user/add’即可 代理后地址栏显示/
        }
      },
      '/zhongsteel.pass.web/pass/configCenter': {
        target: 'https://config.steerinfo.com/configCenter', //加http
        changeOrigin: true,
        pathRewrite: {
          '^/zhongsteel.pass.web/pass/configCenter': '/' //这里理解成用‘/api’代替target里面的地址，组件中我们调接口时直接用/api代替
          // 比如我要调用'http://0.0:300/user/add'，直接写‘/api/user/add’即可 代理后地址栏显示/
        }
      },
      '/zhongsteel.pass.web/pass/serviceCenter': {
        target: 'https://service-govern.steerinfo.com',
        changeOrigin: true,
        pathRewrite: {
          '^/zhongsteel.pass.web/pass': '/'
        }
      },
      '/zhongsteel.pass.web/pass/act': {
        target: 'https://act.steerinfo.com',
        changeOrigin: true,
        pathRewrite: {
          '^/zhongsteel.pass.web/pass/act': '/'
        }
      },
      '/icore-api': {
        target: 'http://172.16.90.238:8088',
        changeOrigin: true,
        pathRewrite: {
          '^/icore-api': '/'
        }
      },
      '/zhongsteel.pass.web/pass/ems': {
        // target: '172.16.90.238:8888',
        target: 'http://localhost:8086',
        changeOrigin: true,
        pathRewrite: {
          '^/zhongsteel.pass.web/pass/ems': '/'
        }
      },
      '/zhongsteel.pass.web/pass/localhost': {
        target: 'http://localhost:8888',
        changeOrigin: true,
        pathRewrite: {
          '^/zhongsteel.pass.web/pass/localhost': '/'
        }
      }
    },

    // Various Dev Server settings
    host: 'localhost', // can be overwritten by process.env.HOST
    port: 8089, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
    autoOpenBrowser: false,
    errorOverlay: true,
    notifyOnErrors: true,
    poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-

    // Use Eslint Loader?
    // If true, your code will be linted during bundling and
    // linting errors and warnings will be shown in the console.
    useEslint: true,
    // If true, eslint errors and warnings will also be shown in the error overlay
    // in the browser.
    showEslintErrorsInOverlay: false,

    /**
     * Source Maps
     */

    // https://webpack.js.org/configuration/devtool/#development
    // devtool: 'cheap-module-eval-source-map',

    // If you have problems debugging vue-files in devtools,
    // set this to false - it *may* help
    // https://vue-loader.vuejs.org/en/options.html#cachebusting
    cacheBusting: true,

    cssSourceMap: false
  },

  build: {
    // Template for index.html
    index: path.resolve(__dirname, '../dist/index.html'),

    // Paths
    assetsRoot: path.resolve(__dirname, '../dist'),
    assetsSubDirectory: 'static', // 打包后 static放的位置
    assetsPublicPath: '../', // html中webpack打包的JS -> ../static/xxx.js
    /**
     * Source Maps
     */

    productionSourceMap: false,
    // https://webpack.js.org/configuration/devtool/#production
    devtool: '#source-map',

    // Gzip off by default as many popular static hosts such as
    // Surge or Netlify already gzip all static assets for you.
    // Before setting to `true`, make sure to:
    // npm install --save-dev compression-webpack-plugin
    productionGzip: false,
    productionGzipExtensions: ['js', 'css'],

    // Run the build command with an extra argument to
    // View the bundle analyzer report after build finishes:
    // `npm run build --report`
    // Set to `true` or `false` to always turn it on or off
    bundleAnalyzerReport: process.env.npm_config_report
  }
}