vue.config.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. module.exports = {
  2. configureWebpack: {
  3. externals: {
  4. 'AMap': 'AMap' // 高德地图JS API
  5. }
  6. },
  7. //路径前缀
  8. publicPath: "/",
  9. lintOnSave: true,
  10. productionSourceMap: false,
  11. chainWebpack: (config) => {
  12. //忽略的打包文件
  13. config.externals({
  14. 'vue': 'Vue',
  15. 'vue-router': 'VueRouter',
  16. 'vuex': 'Vuex',
  17. 'axios': 'axios',
  18. 'element-ui': 'ELEMENT',
  19. });
  20. const entry = config.entry('app');
  21. entry.add('babel-polyfill').end();
  22. entry.add('classlist-polyfill').end();
  23. entry.add('@/mock').end();
  24. },
  25. css: {
  26. extract: { ignoreOrder: true }
  27. },
  28. //开发模式反向代理配置,生产模式请使用Nginx部署并配置反向代理
  29. devServer: {
  30. port: 1024,
  31. proxy: {
  32. '/api': {
  33. //本地服务接口地址
  34. target: 'http://192.168.1.115:1080',
  35. // target: 'http://192.168.1.102:1080',
  36. // target: 'http://124.222.119.174:1080',
  37. // target: 'http://192.168.2.163:1080',
  38. // 打包地址
  39. // target: 'http://121.37.83.47:10004',//服务器ip
  40. //target: 'http://trade.tubaosoft.com:10004',//服务器域名
  41. ws: true,
  42. pathRewrite: {
  43. '^/api': '/'
  44. }
  45. }
  46. }
  47. }
  48. };