vue.config.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. '/account/': {
  44. target: baseUrl,
  45. secure: false,
  46. changeOrigin: true,
  47. },
  48. '/device/': {
  49. target: baseUrl,
  50. secure: false,
  51. changeOrigin: true,
  52. },
  53. '/static/snap': {
  54. target: baseUrl,
  55. secure: false,
  56. changeOrigin: true,
  57. },
  58. },
  59. },
  60. outputDir: '../src/main/resources/static/', // 输出文件目录
  61. // publicPath: '', // 项目部署的基本路径
  62. pages: {
  63. index: {
  64. entry: 'src/pages/index/main.js',
  65. template: 'src/pages/index/index.html',
  66. filename: 'index.html'
  67. },
  68. share: {
  69. entry: 'src/pages/sharePlay/shareMain.js',
  70. template: 'src/pages/sharePlay/index.html',
  71. filename: 'share.html'
  72. },
  73. account: {
  74. entry: 'src/pages/account/main.js',
  75. template: 'src/pages/account/index.html',
  76. filename: 'account.html'
  77. },
  78. device: {
  79. entry: 'src/pages/device/main.js',
  80. template: 'src/pages/device/index.html',
  81. filename: 'device.html'
  82. },
  83. },
  84. configureWebpack: webPackConfig,
  85. css: {
  86. loaderOptions: {
  87. sass: {
  88. additionalData:`@import "./src/assets/scss/style.scss";`
  89. }
  90. }
  91. },
  92. lintOnSave: false,
  93. chainWebpack: config => {
  94. config.plugin('define').tap(args=>{
  95. const argv = process.argv
  96. const icourt = argv[argv.indexOf('--icourt-mode') + 1]
  97. args[0]['process.env'].MODE = `"${icourt}"`
  98. return args
  99. })
  100. const svgRule = config.module.rule('svg')
  101. svgRule.uses.clear()
  102. svgRule.exclude.add(/noe_modules/)
  103. svgRule
  104. .test(/\.svg/)
  105. .use('svg-sprite-loader')
  106. .loader('svg-sprite-loader')
  107. .options({
  108. symbolId: 'icon-[name]'
  109. })
  110. const imagesRule = config.module.rule('images')
  111. imagesRule.exclude.add(resolve('src/icons'))
  112. config.module
  113. .rule('images')
  114. .test(/\.(png|jpe?g|gif|svg)(\?.*)?$/)
  115. }
  116. };