vue.config.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. },
  64. configureWebpack: webPackConfig,
  65. css:{
  66. loaderOptions: {
  67. sass: {
  68. additionalData:`@import "./src/assets/scss/style.scss";`
  69. }
  70. }
  71. },
  72. lintOnSave: false,
  73. chainWebpack: config => {
  74. config.plugin('define').tap(args=>{
  75. const argv = process.argv
  76. const icourt = argv[argv.indexOf('--icourt-mode') + 1]
  77. args[0]['process.env'].MODE = `"${icourt}"`
  78. return args
  79. })
  80. const svgRule = config.module.rule('svg')
  81. svgRule.uses.clear()
  82. svgRule.exclude.add(/noe_modules/)
  83. svgRule
  84. .test(/\.svg/)
  85. .use('svg-sprite-loader')
  86. .loader('svg-sprite-loader')
  87. .options({
  88. symbolId: 'icon-[name]'
  89. })
  90. const imagesRule = config.module.rule('images')
  91. imagesRule.exclude.add(resolve('src/icons'))
  92. config.module
  93. .rule('images')
  94. .test(/\.(png|jpe?g|gif|svg)(\?.*)?$/)
  95. }
  96. };