vue.config.js 951 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. const path = require('path')
  2. function resolve(dir) {
  3. return path.join(__dirname, dir)
  4. }
  5. const name = 'HerTube'
  6. module.exports = {
  7. productionSourceMap: false,
  8. // options...
  9. devServer: {
  10. port: 8080,
  11. // TODO 部署到 nginx 中后,使用 rewrite 指令配置
  12. proxy: {
  13. // 静态资源地址
  14. '/tnb': {
  15. target: process.env.VUE_APP_BASE_API,
  16. changeOrigin: true,
  17. ws: true,
  18. pathRewrite: {
  19. '^/tnb': '/tnb'
  20. }
  21. },
  22. // 弹幕接口
  23. '/api': {
  24. target: process.env.VUE_APP_BASE_API,
  25. changeOrigin: true,
  26. ws: true,
  27. pathRewrite: {
  28. '^/api': '/api'
  29. }
  30. }
  31. }
  32. },
  33. configureWebpack: {
  34. // provide the app's title in webpack's name field, so that
  35. // it can be accessed in index.html to inject the correct title.
  36. name: name,
  37. resolve: {
  38. alias: {
  39. '@': resolve('src')
  40. }
  41. }
  42. }
  43. }