index.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * @Author: your name
  3. * @Date: 2021-06-07 16:40:18
  4. * @LastEditTime: 2021-06-08 14:43:03
  5. * @LastEditors: your name
  6. * @Description: In User Settings Edit
  7. * @FilePath: \ld\config\index.js
  8. */
  9. 'use strict'
  10. // Template version: 1.3.1
  11. // see http://vuejs-templates.github.io/webpack for documentation.
  12. const path = require('path')
  13. module.exports = {
  14. dev: {
  15. // Paths
  16. assetsSubDirectory: 'static',
  17. assetsPublicPath: '/',
  18. proxyTable: {
  19. '/api': {
  20. target: 'http://172.18.1.227:30048', // 你请求的第三方接口
  21. changeOrigin: true, // 在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题
  22. pathRewrite: { // 路径重写,
  23. '/api': '' // 替换target中的请求地址,也就是说以后你在请求http://api.jisuapi.com/XXXXX这个地址的时候直接写成/api即可。
  24. }
  25. }
  26. },
  27. // Various Dev Server settings
  28. host: 'localhost', // can be overwritten by process.env.HOST
  29. port: 9999, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
  30. autoOpenBrowser: true,
  31. errorOverlay: true,
  32. notifyOnErrors: true,
  33. poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
  34. /**
  35. * Source Maps
  36. */
  37. // https://webpack.js.org/configuration/devtool/#development
  38. devtool: 'cheap-module-eval-source-map',
  39. // If you have problems debugging vue-files in devtools,
  40. // set this to false - it *may* help
  41. // https://vue-loader.vuejs.org/en/options.html#cachebusting
  42. cacheBusting: true,
  43. cssSourceMap: true
  44. },
  45. build: {
  46. // Template for index.html
  47. index: path.resolve(__dirname, '../dist/index.html'),
  48. // Paths
  49. assetsRoot: path.resolve(__dirname, '../dist'),
  50. assetsSubDirectory: 'static',
  51. assetsPublicPath: './',
  52. /**
  53. * Source Maps
  54. */
  55. productionSourceMap: true,
  56. // https://webpack.js.org/configuration/devtool/#production
  57. devtool: '#source-map',
  58. // Gzip off by default as many popular static hosts such as
  59. // Surge or Netlify already gzip all static assets for you.
  60. // Before setting to `true`, make sure to:
  61. // npm install --save-dev compression-webpack-plugin
  62. productionGzip: false,
  63. productionGzipExtensions: ['js', 'css'],
  64. // Run the build command with an extra argument to
  65. // View the bundle analyzer report after build finishes:
  66. // `npm run build --report`
  67. // Set to `true` or `false` to always turn it on or off
  68. bundleAnalyzerReport: process.env.npm_config_report
  69. }
  70. }