index.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. 'use strict'
  2. // Template version: 1.3.1
  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://132.232.92.186:8888/api', //设置你调用的接口域名和端口号.别忘了加http
  13. changeOrigin : true, //允许跨域
  14. pathRewrite : {
  15. '^/api':'/'
  16. // '/'这里理解成用‘/api’代替target里面的地址,后面组件中我们掉接口时直接用api代替。比如我要调用'http://api.douban.com/v2/movie/top250',直接写‘/api/v2/movie/top250’即可
  17. }
  18. }
  19. },
  20. // Various Dev Server settings
  21. host: 'localhost', // can be overwritten by process.env.HOST
  22. port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
  23. autoOpenBrowser: false,
  24. errorOverlay: true,
  25. notifyOnErrors: true,
  26. poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
  27. /**
  28. * Source Maps
  29. */
  30. // https://webpack.js.org/configuration/devtool/#development
  31. devtool: 'cheap-module-eval-source-map',
  32. // If you have problems debugging vue-files in devtools,
  33. // set this to false - it *may* help
  34. // https://vue-loader.vuejs.org/en/options.html#cachebusting
  35. cacheBusting: true,
  36. cssSourceMap: true
  37. },
  38. build: {
  39. // Template for index.html
  40. index: path.resolve(__dirname, '../dist/index.html'),
  41. // Paths
  42. assetsRoot: path.resolve(__dirname, '../dist'),
  43. assetsSubDirectory: 'static',
  44. assetsPublicPath: './',
  45. /**
  46. * Source Maps
  47. */
  48. productionSourceMap: false,
  49. // https://webpack.js.org/configuration/devtool/#production
  50. devtool: '#source-map',
  51. // Gzip off by default as many popular static hosts such as
  52. // Surge or Netlify already gzip all static assets for you.
  53. // Before setting to `true`, make sure to:
  54. // npm install --save-dev compression-webpack-plugin
  55. productionGzip: false,
  56. productionGzipExtensions: ['js', 'css'],
  57. // Run the build command with an extra argument to
  58. // View the bundle analyzer report after build finishes:
  59. // `npm run build --report`
  60. // Set to `true` or `false` to always turn it on or off
  61. bundleAnalyzerReport: process.env.npm_config_report
  62. }
  63. }