vue.config.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. module.exports = {
  2. //路径前缀
  3. publicPath: "./",
  4. lintOnSave: true,
  5. productionSourceMap: false,
  6. chainWebpack: (config) => {
  7. //忽略的打包文件
  8. config.externals({
  9. 'vue': 'Vue',
  10. 'vue-router': 'VueRouter',
  11. 'vuex': 'Vuex',
  12. 'axios': 'axios',
  13. 'element-ui': 'ELEMENT',
  14. });
  15. const entry = config.entry('app');
  16. entry.add('babel-polyfill').end();
  17. entry.add('classlist-polyfill').end();
  18. entry.add('@/mock').end();
  19. },
  20. css: {
  21. extract: { ignoreOrder: true }
  22. },
  23. //开发模式反向代理配置,生产模式请使用Nginx部署并配置反向代理
  24. devServer: {
  25. port: 1888,
  26. proxy: {
  27. '/api': {
  28. //本地服务接口地址
  29. target: 'http://127.0.0.1:8080',
  30. // target: 'http://u2mu3zixu5wm.ngrok.xiaomiqiu123.top',
  31. //生产地址
  32. // target: 'https://sellwine.gzzzyd.com/api/',
  33. //生产域名 未备案
  34. //target: 'https://www.gzzhsckj.com',
  35. //远程演示服务地址,可用于直接启动项目
  36. ws: true,
  37. pathRewrite: {
  38. '^/api': ''
  39. }
  40. }
  41. }
  42. }
  43. };