vue.config.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * @Descripttion:
  3. * @version:
  4. * @Author: wt
  5. * @Date: 2023-02-17 11:09:01
  6. * @LastEditors: wt
  7. * @LastEditTime: 2023-02-17 11:24:46
  8. */
  9. const path = require('path')
  10. function resolve(dir) {
  11. return path.join(__dirname, dir);
  12. }
  13. // 基本结构
  14. module.exports = {
  15. // 打包后路径错误导致的空白页面问题。
  16. // publicPath: '/vuefiv/',
  17. // publicPath: '/panel/',
  18. publicPath: '/backStage/',
  19. outputDir: process.env.outputDir,
  20. // assetsPublicPath: '/vuefiv/',
  21. // assetsDir: 'vuefiv',
  22. // * 分别为生成环境和开发环境配置
  23. configureWebpack: config => {
  24. if (process.env.NODE_ENV === 'production') {
  25. // 为生产环境修改配置...
  26. config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
  27. } else {
  28. // 为开发环境修改配置...
  29. }
  30. Object.assign(config, {
  31. externals: {
  32. 'AMap': 'AMap',
  33. 'AMapUI': 'AMapUI'
  34. },
  35. resolve: {
  36. extensions: ['.js', '.vue', '.json'],
  37. alias: {
  38. '@': resolve('src'),
  39. '~': process.cwd(),
  40. public: resolve('public'),
  41. components: resolve('src/components'),
  42. util: resolve('src/utils'),
  43. store: resolve('src/store'),
  44. router: resolve('src/router')
  45. }
  46. },
  47. })
  48. },
  49. devServer: {
  50. hot: true, //自动保存
  51. proxy: {
  52. // '/vuefiv/': {
  53. './backStage/': {
  54. // target: 'https://qhome.usky.cn/fivapi',
  55. target: 'http://172.16.120.165:8011',
  56. ws: false,
  57. changeOrigin: true,
  58. pathRewrite: {
  59. '^./': './'
  60. }
  61. }
  62. },
  63. public: 'localhost:8080/backStage/'
  64. }
  65. }