index.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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://service.sagacloud.cn:28888",//设置你调用的接口域名和端口号 别忘了加http
  13. //changeOrigin: true,
  14. pathRewrite: {
  15. '^/api': '/' // 这里理解成用‘/api’代替target里面的地址,后面组件中我们掉接口时直接用api代替 比如我要调用'http://40.00.100.100:3002/user/add',直接写‘/api/user/add’即可
  16. }
  17. },
  18. '/equipment': {
  19. target:"http://172.17.134.225:8888",//设备设施代理
  20. changeOrigin: true,
  21. pathRewrite: {
  22. '^/equipment': '/' // 这里理解成用‘/api’代替target里面的地址,后面组件中我们掉接口时直接用api代替 比如我要调用'http://40.00.100.100:3002/user/add',直接写‘/api/user/add’即可
  23. }
  24. },
  25. '/enviroment':{
  26. target:"http://service.sagacloud.cn:28888",
  27. changeOrigin:true,
  28. pathRewrite: {
  29. '^/enviroment': '/' // 这里理解成用‘/api’代替target里面的地址,后面组件中我们掉接口时直接用api代替 比如我要调用'http://40.00.100.100:3002/user/add',直接写‘/api/user/add’即可
  30. }
  31. }
  32. },
  33. // Various Dev Server settings
  34. host: 'localhost', // can be overwritten by process.env.HOST
  35. disableHostCheck: true,
  36. port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
  37. autoOpenBrowser: false,
  38. errorOverlay: true,
  39. notifyOnErrors: true,
  40. poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
  41. // Use Eslint Loader?
  42. // If true, your code will be linted during bundling and
  43. // linting errors and warnings will be shown in the console.
  44. useEslint: false,
  45. // If true, eslint errors and warnings will also be shown in the error overlay
  46. // in the browser.
  47. showEslintErrorsInOverlay: false,
  48. /**
  49. * Source Maps
  50. */
  51. // https://webpack.js.org/configuration/devtool/#development
  52. devtool: 'cheap-module-eval-source-map',
  53. // If you have problems debugging vue-files in devtools,
  54. // set this to false - it *may* help
  55. // https://vue-loader.vuejs.org/en/options.html#cachebusting
  56. cacheBusting: true,
  57. cssSourceMap: true
  58. },
  59. build: {
  60. // Template for index.html
  61. index: path.resolve(__dirname, '../dist/index.html'),
  62. // Paths
  63. assetsRoot: path.resolve(__dirname, '../dist'),
  64. assetsSubDirectory: 'static',
  65. assetsPublicPath: '/',
  66. /**
  67. * Source Maps
  68. */
  69. productionSourceMap: true,
  70. // https://webpack.js.org/configuration/devtool/#production
  71. devtool: '#source-map',
  72. // Gzip off by default as many popular static hosts such as
  73. // Surge or Netlify already gzip all static assets for you.
  74. // Before setting to `true`, make sure to:
  75. // npm install --save-dev compression-webpack-plugin
  76. productionGzip: false,
  77. productionGzipExtensions: ['js', 'css'],
  78. // Run the build command with an extra argument to
  79. // View the bundle analyzer report after build finishes:
  80. // `npm run build --report`
  81. // Set to `true` or `false` to always turn it on or off
  82. bundleAnalyzerReport: process.env.npm_config_report
  83. }
  84. }