vue.config.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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://192.168.3.64',
  30. target: 'http://47.110.251.215:8090',
  31. // target: 'http://192.168.1.179',
  32. // target: 'http://192.168.31.96',
  33. //远程演示服务地址,可用于直接启动项目
  34. //target: 'https://saber.bladex.vip/api',
  35. ws: true,
  36. pathRewrite: {
  37. '^/api': '/'
  38. }
  39. }
  40. }
  41. }
  42. };