const path = require('path')

function resolve(dir) {
  return path.join(__dirname, dir)
}

const name = 'bili'

module.exports = {
  productionSourceMap: false,
  // options...
  devServer: {
    port: 8080,
    disableHostCheck: true
    // TODO 部署到 nginx 中后，使用 rewrite 指令配置
    /*    proxy: {
      '/tnb': {
        target: process.env.VUE_APP_BASE_API,
        changeOrigin: true,
        ws: true,
        pathRewrite: {
          '^/tnb': '/tnb'
        }
      },
      '/api': {
        target: process.env.VUE_APP_BASE_API,
        changeOrigin: true,
        ws: true,
        pathRewrite: {
          '^/api': '/api'
        }
      }
    }*/
  },
  configureWebpack: {
    // provide the app's title in webpack's name field, so that
    // it can be accessed in index.html to inject the correct title.
    name: name,
    resolve: {
      alias: {
        '@': resolve('src')
      }
    }
  }
}
