vue.config.js 1.6 KB

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