vue.config.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * @Author: your name
  3. * @Date: 2021-04-28 11:40:44
  4. * @LastEditTime: 2021-04-29 09:25:44
  5. * @LastEditors: Please set LastEditors
  6. * @Description: In User Settings Edit
  7. * @FilePath: \nn19030510admin\vue.config.js
  8. */
  9. const path = require('path')
  10. const resolve = dir => {
  11. return path.join(__dirname, dir)
  12. }
  13. // 项目部署基础
  14. // 默认情况下,我们假设你的应用将被部署在域的根目录下,
  15. // 例如:https://www.my-app.com/
  16. // 默认:'/'
  17. // 如果您的应用程序部署在子路径中,则需要在这指定子路径
  18. // 例如:https://www.foobar.com/my-app/
  19. // 需要将它改为'/my-app/'
  20. const BASE_URL = process.env.NODE_ENV === 'production'
  21. ? '/admin'
  22. : '/admin'
  23. module.exports = {
  24. // Project deployment base
  25. // By default we assume your app will be deployed at the root of a domain,
  26. // e.g. https://www.my-app.com/
  27. // If your app is deployed at a sub-path, you will need to specify that
  28. // sub-path here. For example, if your app is deployed at
  29. // https://www.foobar.com/my-app/
  30. // then change this to '/my-app/'
  31. // baseUrl: BASE_URL,
  32. // baseUrl: "./",
  33. publicPath: BASE_URL,
  34. // tweak internal webpack configuration.
  35. // see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
  36. // 如果你不需要使用eslint,把lintOnSave设为false即可
  37. lintOnSave: false,
  38. chainWebpack: config => {
  39. config.resolve.alias
  40. .set('@', resolve('src')) // key,value自行定义,比如.set('@@', resolve('src/components'))
  41. .set('_c', resolve('src/components'))
  42. },
  43. // 打包时不生成.map文件
  44. productionSourceMap: false,
  45. configureWebpack:{
  46. performance: { // 关闭性能提示
  47. hints: false,
  48. },
  49. optimization:{
  50. minimize:true,
  51. splitChunks:{
  52. chunks: 'all',
  53. }
  54. }
  55. },
  56. // 这里写你调用接口的基础路径,来解决跨域,如果设置了代理,那你本地开发环境的axios的baseUrl要写为 '' ,即空字符串
  57. devServer: {
  58. proxy: {
  59. '^/api': {
  60. // target:'http://www.10dsm.com/',
  61. target:'http://dsm.mp.dongerkj.com/',
  62. // target: 'http://10dsm.test.kotlin.net.cn/',
  63. changeOrigin: true,
  64. pathRewrite: {
  65. '^/api': '/api'// 重写,
  66. }
  67. },
  68. '^/admins': {
  69. target:'http://dsm.mp.dongerkj.com/',
  70. // target: 'http://10dsm.test.kotlin.net.cn/',
  71. changeOrigin: true,
  72. pathRewrite: {
  73. '^/admins': '/admins'// 重写,
  74. }
  75. },
  76. },
  77. disableHostCheck: true,
  78. compress: true,
  79. },
  80. assetsDir:"static" // 静态文件目录
  81. }