vue.config.js 896 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. const productConfig = require('./public/config.json')
  2. const path = require('path')
  3. module.exports = {
  4. // 选项...
  5. publicPath: '/',
  6. devServer: {
  7. disableHostCheck: true,
  8. host: '0.0.0.0',
  9. proxy: {
  10. //配置代理,解决跨域请求后台数据的问题
  11. '/api': {
  12. target: productConfig.baseUrl, //后台接口,连接本地服务
  13. ws: true, //是否跨域
  14. changeOrigin: true,
  15. pathRewrite: {
  16. '^/api': '/'
  17. }
  18. }
  19. }
  20. },
  21. productionSourceMap: false,
  22. pluginOptions: {
  23. 'style-resources-loader': {
  24. preProcessor: 'stylus',
  25. patterns: []
  26. }
  27. },
  28. configureWebpack: (config) => {
  29. config.resolve.alias = {
  30. '@': path.resolve(__dirname, './src'),
  31. _v: path.resolve(__dirname, './src/views'),
  32. _c: path.resolve(__dirname, './src/components'),
  33. _a: path.resolve(__dirname, './src/assets'),
  34. _r: path.resolve(__dirname, './src/request')
  35. }
  36. }
  37. }