vue.config.js 911 B

123456789101112131415161718192021222324252627282930313233343536
  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. //开发模式反向代理配置,生产模式请使用Nginx部署并配置反向代理
  21. devServer: {
  22. port: 1888,
  23. proxy: {
  24. '/api': {
  25. //本地服务接口地址
  26. target: 'http://localhost',
  27. //远程演示服务地址,可用于直接启动项目
  28. //target: 'https://saber.bladex.vip/api',
  29. ws: true,
  30. pathRewrite: {
  31. '^/api': '/'
  32. }
  33. }
  34. }
  35. }
  36. };