vue.config.js 1.0 KB

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