vue.config.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. disableHostCheck: true,
  26. port: 1888,
  27. proxy: {
  28. '/api': {
  29. //本地服务接口地址
  30. target: 'http://localhost:8000',
  31. ws: true,
  32. pathRewrite: {
  33. '^/api': '/'
  34. }
  35. },
  36. '/oss': {
  37. //本地服务接口地址
  38. target: 'http://116.62.106.199:9000',
  39. ws: true,
  40. pathRewrite: {
  41. '^/oss': '/'
  42. }
  43. }
  44. }
  45. },
  46. };