vue.config.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. const path = require('path')
  2. const webPackConfig = require('./webpack.config');
  3. function resolve(dir) {
  4. // console.log(dir);
  5. return path.join(__dirname, dir);
  6. }
  7. const baseUrl = "https://127.0.0.1:19200"
  8. // const baseUrl = "https://hofuniot.cn:29072"
  9. // const c =
  10. module.exports = {
  11. devServer: {
  12. port: 8080,
  13. https: true,
  14. proxy: {
  15. '/api/': {
  16. target: baseUrl,
  17. ws: true,
  18. changeOrigin: true,
  19. },
  20. '/debug': {
  21. target: baseUrl,
  22. ws: true,
  23. changeOrigin: true,
  24. pathRewrite: {
  25. '^/debug': '/'
  26. }
  27. },
  28. '/ai': {
  29. target: baseUrl,
  30. secure: false,
  31. changeOrigin: true,
  32. },
  33. '/aiLib': {
  34. target: baseUrl,
  35. secure: false,
  36. changeOrigin: true,
  37. },
  38. '/mFile': {
  39. target: baseUrl,
  40. secure: false,
  41. changeOrigin: true,
  42. },
  43. '/static/snap': {
  44. target: baseUrl,
  45. secure: false,
  46. changeOrigin: true,
  47. },
  48. },
  49. },
  50. outputDir: '../src/main/resources/static/', // 输出文件目录
  51. // publicPath: '', // 项目部署的基本路径
  52. pages: {
  53. index: {
  54. entry: 'src/pages/index/main.js',
  55. template: 'src/pages/index/index.html',
  56. filename: 'index.html'
  57. },
  58. share: {
  59. entry: 'src/pages/sharePlay/shareMain.js',
  60. template: 'src/pages/sharePlay/index.html',
  61. filename: 'share.html'
  62. },
  63. account: {
  64. entry: 'src/pages/account/main.js',
  65. template: 'src/pages/account/index.html',
  66. filename: 'account.html'
  67. }
  68. },
  69. configureWebpack: webPackConfig,
  70. css: {
  71. loaderOptions: {
  72. sass: {
  73. additionalData:`@import "./src/assets/scss/style.scss";`
  74. }
  75. }
  76. },
  77. lintOnSave: false,
  78. chainWebpack: config => {
  79. config.plugin('define').tap(args=>{
  80. const argv = process.argv
  81. const icourt = argv[argv.indexOf('--icourt-mode') + 1]
  82. args[0]['process.env'].MODE = `"${icourt}"`
  83. return args
  84. })
  85. const svgRule = config.module.rule('svg')
  86. svgRule.uses.clear()
  87. svgRule.exclude.add(/noe_modules/)
  88. svgRule
  89. .test(/\.svg/)
  90. .use('svg-sprite-loader')
  91. .loader('svg-sprite-loader')
  92. .options({
  93. symbolId: 'icon-[name]'
  94. })
  95. const imagesRule = config.module.rule('images')
  96. imagesRule.exclude.add(resolve('src/icons'))
  97. config.module
  98. .rule('images')
  99. .test(/\.(png|jpe?g|gif|svg)(\?.*)?$/)
  100. }
  101. };