vue.config.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. const path = require('path')
  2. function resolve(dir) {
  3. return path.join(__dirname, dir);
  4. }
  5. // 基本结构
  6. module.exports = {
  7. // 打包后路径错误导致的空白页面问题。
  8. publicPath: '/vuefiv/',
  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. // './': {
  42. // target: 'http://124.71.174.104:80/api',
  43. // ws: false,
  44. // changeOrigin: true,
  45. // pathRewrite: {
  46. // '^/api': 'http://124.71.174.104:80/api'
  47. // }
  48. // }
  49. // }
  50. // }
  51. }