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: './',
  9. outputDir: process.env.outputDir,
  10. // * 分别为生成环境和开发环境配置
  11. configureWebpack: config => {
  12. if (process.env.NODE_ENV === 'production') {
  13. // 为生产环境修改配置...
  14. config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
  15. } else {
  16. // 为开发环境修改配置...
  17. }
  18. Object.assign(config, {
  19. externals: {
  20. 'AMap': 'AMap',
  21. 'AMapUI': 'AMapUI'
  22. },
  23. resolve: {
  24. extensions: ['.js', '.vue', '.json'],
  25. alias: {
  26. '@': resolve('src'),
  27. '~': process.cwd(),
  28. // public: resolve('public'),
  29. components: resolve('src/components'),
  30. util: resolve('src/utils'),
  31. store: resolve('src/store'),
  32. router: resolve('src/router')
  33. }
  34. }
  35. })
  36. },
  37. // build: {
  38. // assetsPublicPath: '/vuefiv/'
  39. // }
  40. // devServer: {
  41. // proxy: {
  42. // './': {
  43. // target: 'http://124.71.174.104:80/api',
  44. // ws: false,
  45. // changeOrigin: true,
  46. // pathRewrite: {
  47. // '^/api': 'http://124.71.174.104:80/api'
  48. // }
  49. // }
  50. // }
  51. // }
  52. }