vue.config.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. const path = require('path')
  2. module.exports = {
  3. // 选项...
  4. publicPath: '/',
  5. devServer: {
  6. disableHostCheck: true,
  7. host: '0.0.0.0',
  8. // 配置代理,解决本地开发环境下跨域请求后台接口的问题,proxy 中的修改项修改完后需要重启项目才可生效
  9. proxy: {
  10. '/api': {
  11. target: 'http://localhost:8080', // 本地开发环境 - 连接后台接口
  12. ws: true, //是否跨域
  13. changeOrigin: true,
  14. pathRewrite: {
  15. '^/api': '/'
  16. }
  17. }
  18. }
  19. },
  20. productionSourceMap: false,
  21. // 修改或新增 html-webpack-plugin 的值,在 index.html 里面能读取 htmlWebpackPlugin.options.title
  22. chainWebpack: (config) => {
  23. config.plugin('html').tap((args) => {
  24. args[0].title = '奇文网盘'
  25. return args
  26. })
  27. },
  28. pluginOptions: {
  29. 'style-resources-loader': {
  30. preProcessor: 'stylus',
  31. patterns: []
  32. }
  33. },
  34. configureWebpack: (config) => {
  35. config.resolve.alias = {
  36. '@': path.resolve(__dirname, './src'),
  37. _v: path.resolve(__dirname, './src/views'),
  38. _c: path.resolve(__dirname, './src/components'),
  39. _a: path.resolve(__dirname, './src/assets'),
  40. _r: path.resolve(__dirname, './src/request'),
  41. _public: path.resolve(__dirname, './public')
  42. }
  43. }
  44. }