module.exports = {
  publicPath: './',
  assetsDir: 'static',
  // productionSourceMap: false,

  // 代理
  devServer: {
    proxy: {
      '^/plant/': {
        // target: 'http://8.130.25.40',
        target: 'http://192.168.110.168:8256',
        // target: 'http://192.168.43.122:8258',
        ws: true,
        changeOrigin: true,
        pathRewrite: {
          // '/plant/' : '/'
        }
      }
    }
  },

  // gzip压缩
  configureWebpack: config => {
    const CompressionWebpackPlugin = require('compression-webpack-plugin');
    config.plugins.push(
      new CompressionWebpackPlugin()
    )
  },

  chainWebpack: config => {
    const oneOfsMap = config.module.rule('scss').oneOfs.store
    oneOfsMap.forEach(item => {
      item
        .use('sass-resources-loader')
        .loader('sass-resources-loader')
        .options({
          resources: './src/style/index.scss',
        })
        .end()
    })
    config
      .plugin('html')
      .tap(args => {
        args[0].title = 'hn-monitor'
        return args
      })
  }

};
