index.js 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. 'use strict'
  2. // Template version: 1.2.6
  3. // see http://vuejs-templates.github.io/webpack for documentation.
  4. const path = require('path')
  5. module.exports = {
  6. dev: {
  7. // Paths
  8. assetsSubDirectory: 'static',
  9. assetsPublicPath: '/',
  10. proxyTable: {
  11. '/api': {
  12. target: 'http://hf.sgjyun.com',//设置你调用的接口域名和端口号 别忘了加http 正式
  13. // target: 'http://hf.szjkhd.com',//设置你调用的接口域名和端口号 别忘了加http 测试
  14. changeOrigin: true,//设置true 代表跨域访问
  15. secure: false, // 如果是https接口,需要配置这个参数
  16. pathRewrite: {
  17. '^/api': '/'//这里理解成用‘/api’代替target里面的地址,后面组件中我们掉接口时直接用api代替 比如我要调用'http://40.00.100.100:3002/user/add',直接写‘/api/user/add’即可
  18. }
  19. }
  20. },
  21. // Various Dev Server settings
  22. // can be overwritten by process.env.HOST
  23. // if you want dev by ip, please set host: '0.0.0.0'
  24. // host: 'xt.test.sgjyun.com',
  25. // host: 'xt.kuyicloud.com',
  26. // host: 'xt.test.sgjyun.com',
  27. host: 'localhost',
  28. port: 9528, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
  29. autoOpenBrowser: true,
  30. errorOverlay: true,
  31. notifyOnErrors: false,
  32. poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
  33. // Use Eslint Loader?
  34. // If true, your code will be linted during bundling and
  35. // linting errors and warnings will be shown in the console.
  36. useEslint: false,
  37. // If true, eslint errors and warnings will also be shown in the error overlay
  38. // in the browser.
  39. showEslintErrorsInOverlay: false,
  40. /**
  41. * Source Maps
  42. */
  43. // https://webpack.js.org/configuration/devtool/#development
  44. devtool: '#cheap-source-map',
  45. // If you have problems debugging vue-files in devtools,
  46. // set this to false - it *may* help
  47. // https://vue-loader.vuejs.org/en/options.html#cachebusting
  48. cacheBusting: true,
  49. // CSS Sourcemaps off by default because relative paths are "buggy"
  50. // with this option, according to the CSS-Loader README
  51. // (https://github.com/webpack/css-loader#sourcemaps)
  52. // In our experience, they generally work as expected,
  53. // just be aware of this issue when enabling this option.
  54. cssSourceMap: false
  55. },
  56. build: {
  57. // Template for index.html
  58. index: path.resolve(__dirname, '../dist/index.html'),
  59. // Paths
  60. assetsRoot: path.resolve(__dirname, '../dist'),
  61. assetsSubDirectory: 'static',
  62. /**
  63. * You can set by youself according to actual condition
  64. * You will need to set this if you plan to deploy your site under a sub path,
  65. * for example GitHub pages. If you plan to deploy your site to https://foo.github.io/bar/,
  66. * then assetsPublicPath should be set to "/bar/".
  67. * In most cases please use '/' !!!
  68. */
  69. // assetsPublicPath: '/vue-element-admin/', // If you are deployed on the root path, please use '/'
  70. assetsPublicPath: './',
  71. /**
  72. * Source Maps
  73. */
  74. productionSourceMap: false,
  75. // https://webpack.js.org/configuration/devtool/#production
  76. devtool: '#source-map',
  77. // Gzip off by default as many popular static hosts such as
  78. // Surge or Netlify already gzip all static assets for you.
  79. // Before setting to `true`, make sure to:
  80. // npm install --save-dev compression-webpack-plugin
  81. productionGzip: false,
  82. productionGzipExtensions: ['js', 'css'],
  83. // Run the build command with an extra argument to
  84. // View the bundle analyzer report after build finishes:
  85. // `npm run build --report`
  86. // Set to `true` or `false` to always turn it on or off
  87. bundleAnalyzerReport: process.env.npm_config_report
  88. },
  89. }