vue.config.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. const path = require('path')
  2. function resolve(dir) {
  3. return path.join(__dirname, dir)
  4. }
  5. const baseUrl = process.env.VUE_APP_API_BASE_URL
  6. //自定义配置信息
  7. // const defaultSettings = require('./src/utils/settings.js')
  8. // const name = defaultSettings.sysTitle || '登录系统' // page title
  9. /**
  10. * @description vue 配置相关
  11. */
  12. module.exports = {
  13. publicPath: './',
  14. outputDir: 'dist',
  15. assetsDir: 'static',
  16. // indexPath: 'index.html',
  17. // lintOnSave: 'default',
  18. productionSourceMap: false, // 生产环境是否生成 sourceMap 文件
  19. devServer: {
  20. port: "9000", // 端口
  21. open: true, // 自动开启浏览器
  22. compress: false, // 开启压缩
  23. overlay: {
  24. warnings: false,
  25. errors: false
  26. },
  27. proxy: {
  28. '/api': {
  29. target: baseUrl,
  30. changeOrigin: true,
  31. pathRewrite: {
  32. '^/api': 'http://117.176.120.161:1111'
  33. }
  34. },
  35. '/service':{
  36. //target: 'http://221.182.8.141:10005',
  37. target: 'http://221.236.31.30:8085',
  38. changeOrigin: true,
  39. pathRewrite: {
  40. '^/service': '/service'
  41. }
  42. },
  43. }
  44. },
  45. css: {
  46. // 是否使用css分离插件 ExtractTextPlugin
  47. extract: true,
  48. // 开启 CSS source maps?
  49. // sourceMap: false,
  50. // css预设器配置项
  51. loaderOptions: {
  52. // pass options to sass-loader
  53. sass: {
  54. // 引入全局变量样式,@使我们设置的别名,执行src目录
  55. //data: `@import "@/styles/index.scss";`
  56. }
  57. },
  58. requireModuleExtension: true
  59. },
  60. configureWebpack: {
  61. },
  62. chainWebpack:(config) =>{
  63. config.resolve.alias
  64. .set('@views',resolve('src/views'))
  65. }
  66. }