vue.config.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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.3.64:1080',
  35. // target: 'http://192.168.8.106:1080',
  36. target: 'http://127.0.0.1:1080',
  37. // 打包地址
  38. // target: 'http://121.37.83.47:10004',//服务器ip
  39. // target: 'http://trade.tubaosoft.com:10004',//服务器域名
  40. ws: true,
  41. pathRewrite: {
  42. '^/api': '/'
  43. }
  44. }
  45. }
  46. }
  47. };