'use strict'
const path = require('path')
// const defaultSettings = require('./src/settings.js')

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


const port = process.env.port || process.env.npm_config_port || 9528

module.exports = {
  publicPath: './',
  outputDir: 'dist',
  assetsDir: 'static',
  lintOnSave: process.env.NODE_ENV === 'development',
  productionSourceMap: false,
  devServer: {
    port: port,
    open: true,
    overlay: {
      warnings: false,
      errors: false
    },
    proxy: {
      '/admin': {
        // target: 'http://120.24.85.77:8087', // 正式环境
        // target: 'http://192.168.0.83:8085'  // 伟玉本地环境
        target: 'http://39.108.220.65:8085'    // 测试环境
      },
      '/node-upload': {
        target: 'http://39.108.220.65:1935',
      },
    }
    // before: require('./mock/mock-server.js')
  },
  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: '看房4DKanKan-管理后台',
    resolve: {
      alias: {
        '@': resolve('src'),
        'api': resolve('src/api'),
        'libs': resolve('src/libs'),
        'vue$': 'vue/dist/vue.esm.js',
        // 定义静态资源快捷路径
        'assets': resolve('src/assets'),
        // 定义组建模块快捷路径
        'components': resolve('src/components'),
        // 定义配置模块快捷路径
        'config': resolve('src/config'),
        // 定义指令模块快捷路径
        'directive': resolve('src/directive'),
        // 定义骨架模块快捷路径
        'layout': resolve('src/layout'),
        // 定义插件模块快捷路径
        'plugin': resolve('src/plugin'),
        // 定义注册模块快捷路径
        'register': resolve('src/register'),
        // 定义路由模块快捷路径
        'router': resolve('src/router'),
        // 定义仓库模块快捷路径
        'store': resolve('src/store'),
        // 定义视图模块快捷路径
        'views': resolve('src/views')
      }
    }
  },
  css: {
    loaderOptions: {
      // 给 less-loader 传递 Less.js 相关选项
      less: {
        javascriptEnabled: true
      }
    }
  }
}
