const { defineConfig } = require('@vue/cli-service')
const path = require("path");

function resolve(dir) {
  return path.join(__dirname, dir);
}
const name = '调度APP' // page title
module.exports = defineConfig({
  transpileDependencies: true,
  // 基本路径
  // publicPath: "./",s
  publicPath: '/h5/supplier/dispatch',
  // publicPath: process.env.NODE_ENV === 'production' ,
  // lintOnSave: process.env.NODE_ENV === 'development',
  devServer: {
    https: false,
    port: 8080,
    // open: true,
    // disableHostCheck: true,
    // allowedHosts: [
    //   'supplierwxtest.sino-assist.com',
    //   'www.sinoassist.com'
    // ],
    proxy: {
      [process.env.VUE_APP_BASE_API]: {
        target: 'https://api1.sino-assist.com',
        ws: false,
        changeOrigin: true,
        pathRewrite: {
          ['^' + process.env.VUE_APP_BASE_API]: '' // 路径重写
        }
      }
    },
    // historyApiFallback: {
    //   index: '/index.html'
    //   //与output的publicPath有关(HTMLplugin生成的html默认为index.html)
    // },
  },
  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')
      }
    }
  },
  // 生产环境是否生成 sourceMap 文件
  productionSourceMap: false,
  // css: {
  //   loaderOptions: {
  //     postcss: {
  //       plugins: [
  //         require('postcss-pxtorem')({
  //           rootValue: 16,
  //           unitPrecision: 5,
  //           propList: ['font', 'font-size', 'line-height', 'letter-spacing'],
  //           selectorBlackList: [],
  //           replace: true,
  //           mediaQuery: false,
  //           minPixelValue: 0,
  //           exclude: /node_modules/i
  //         })
  //       ]
  //     }
  //   }
  // }
})
