vue.config.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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: 1024,
  26. proxy: {
  27. '/api': {
  28. //本地服务接口地址
  29. // target: 'http://192.168.1.177:1080',
  30. // target: 'http://192.168.1.151:1080',
  31. // 打包地址.
  32. target: 'http://121.37.83.47:10004',//服务器ip
  33. // target: 'http://trade.tubaosoft.com:10004',//服务器域名
  34. ws: true,
  35. pathRewrite: {
  36. '^/api': '/'
  37. }
  38. }
  39. }
  40. }
  41. };