vue.config.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. 'use strict'
  2. const path = require('path')
  3. function resolve(dir) {
  4. return path.join(__dirname, dir)
  5. }
  6. const name = process.env.VUE_APP_TITLE || '门店拜访' // 网页标题
  7. const port = process.env.port || process.env.npm_config_port || 80 // 端口
  8. module.exports = {
  9. // publicPath: process.env.NODE_ENV === "production" ? "/mobile/" : "/",
  10. publicPath: "/mobile/",
  11. outputDir: 'mobile',
  12. assetsDir: 'static',
  13. lintOnSave: false,
  14. productionSourceMap: false,
  15. devServer: {
  16. port: port,
  17. open: true,
  18. proxy: {
  19. [process.env.VUE_APP_BASE_API]: {
  20. target: process.env.VUE_APP_Target,
  21. changeOrigin: true,
  22. pathRewrite: {
  23. ['^' + process.env.VUE_APP_BASE_API]:process.env.VUE_APP_BASE_API+''
  24. }
  25. },
  26. },
  27. disableHostCheck: true
  28. },
  29. configureWebpack: {
  30. name: name,
  31. resolve: {
  32. alias: {
  33. '@': resolve('src')
  34. }
  35. }
  36. },
  37. chainWebpack(config) {
  38. config.plugins.delete('preload') // TODO: need test
  39. config.plugins.delete('prefetch') // TODO: need test
  40. config.when(process.env.NODE_ENV !== 'development',
  41. config => {
  42. config.optimization.runtimeChunk('single'),
  43. {
  44. from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
  45. to: './' //到根目录下
  46. }
  47. }
  48. )
  49. }
  50. }