vue.config.js 821 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // "use strict";
  2. const path = require('path')
  3. function resolve(dir) {
  4. return path.join(__dirname, dir)
  5. }
  6. const port = process.env.port || process.env.npm_config_port || 8081 // dev port
  7. module.exports = {
  8. // 生成环境配置
  9. // 默认按部署在服务器根路径配置
  10. // 编译时资源按相对路径声明,可部署在任意路径
  11. publicPath: './',
  12. outputDir: 'dist',
  13. assetsDir: 'static',
  14. lintOnSave: process.env.NODE_ENV === 'development',
  15. productionSourceMap: false,
  16. filenameHashing: true,
  17. devServer: {
  18. disableHostCheck: true, // 解决 Invalid Host header
  19. port: port,
  20. host: 'localhost',
  21. overlay: {
  22. warnings: false,
  23. errors: true
  24. },
  25. proxy: {
  26. '/api': {
  27. target: 'http://localhost:8080/',
  28. changeOrigin: true,
  29. }
  30. }
  31. },
  32. }