index.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. // 网站模块名,例如 http://192.168.0.216:8089/module/app/initlayer.html 中的
  7. //【views】,默认为views,修改这里的配置的同时,也要同时重命名/src/views的这个文件夹名称
  8. // moduleName: 'xinsteel.ytg', // http://localhost:8081/#/views/user.html
  9. dev: {
  10. // Paths
  11. assetsSubDirectory: 'static',
  12. assetsPublicPath: '/',
  13. proxyTable: {
  14. '/ytg.pass.web/pass': {
  15. target: 'http://172.16.81.200:9001',
  16. // target: 'http://172.16.0.76:9001', //加http 测试服务器访问ip
  17. // target: 'http://6.6.6.6:9001', //加http ,正式服务器接口访问ip
  18. changeOrigin: true,
  19. pathRewrite: {
  20. '^/ytg.pass.web/pass': '/' //这里理解成用‘/api’代替target里面的地址,组件中我们调接口时直接用/api代替
  21. // 比如我要调用'http://0.0:300/user/add',直接写‘/api/user/add’即可 代理后地址栏显示/
  22. }
  23. },
  24. '/icore-api': {
  25. target: 'http://172.16.0.76:9001', //加http
  26. changeOrigin: true,
  27. pathRewrite: {
  28. '^/icore-api': '/' //这里理解成用‘/api’代替target里面的地址,组件中我们调接口时直接用/api代替
  29. // 比如我要调用'http://0.0:300/user/add',直接写‘/api/user/add’即可 代理后地址栏显示/
  30. }
  31. },
  32. '/xinsteel.maketx': {
  33. // target: 'http://172.16.0.76:8003', //加http
  34. // target: 'http://172.16.81.200:8007', //加http 测试正式环境,有分布式文件
  35. // target: 'http://172.16.0.76', //加http5
  36. // 本地连接正式环境用于测试:
  37. // target: 'http://172.16.81.200',
  38. // target: 'http://zhaolinzhi12.e2.luyouxia.net:20408',
  39. // target: 'http://6.6.6.6',
  40. // target: 'http://192.168.1.103:8080', // 老赵的本机服务ip
  41. target: 'http://127.0.0.1:8080', // 本地运行
  42. // 本地 end
  43. changeOrigin: true,
  44. pathRewrite: {
  45. '^/xinsteel.maketx': '/xinsteel.maketx' //这里理解成用‘/api’代替target里面的地址,组件中我们调接口时直接用/api代替
  46. // 比如我要调用'http://0.0:300/user/add',直接写‘/api/user/add’即可 代理后地址栏显示/
  47. }
  48. },
  49. // '/xinsteel.pass.web/service': {
  50. // target: 'http://172.16.0.76:8003/xinsteel.maketx/service', //加http
  51. // changeOrigin: true,
  52. // pathRewrite: {
  53. // '^/xinsteel.pass.web/service': '/' //这里理解成用‘/api’代替target里面的地址,组件中我们调接口时直接用/api代替
  54. // // 比如我要调用'http://0.0:300/user/add',直接写‘/api/user/add’即可 代理后地址栏显示/
  55. // }
  56. // }
  57. },
  58. // Various Dev Server settings
  59. host: 'localhost', // can be overwritten by process.env.HOST
  60. port: 8802, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
  61. autoOpenBrowser: false,
  62. errorOverlay: true,
  63. notifyOnErrors: true,
  64. poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
  65. // Use Eslint Loader?
  66. // If true, your code will be linted during bundling and
  67. // linting errors and warnings will be shown in the console.
  68. useEslint: true,
  69. // If true, eslint errors and warnings will also be shown in the error overlay
  70. // in the browser.
  71. showEslintErrorsInOverlay: false,
  72. /**
  73. * Source Maps
  74. */
  75. // https://webpack.js.org/configuration/devtool/#development
  76. // devtool: 'cheap-module-eval-source-map',
  77. // If you have problems debugging vue-files in devtools,
  78. // set this to false - it *may* help
  79. // https://vue-loader.vuejs.org/en/options.html#cachebusting
  80. cacheBusting: true,
  81. cssSourceMap: false
  82. },
  83. build: {
  84. // Template for index.html
  85. index: path.resolve(__dirname, '../dist/mes/index.html'),
  86. // Paths
  87. assetsRoot: path.resolve(__dirname, '../dist/mes'),
  88. assetsSubDirectory: 'static', // 打包后 static放的位置
  89. assetsPublicPath: '../', // html中webpack打包的JS -> ../static/xxx.js
  90. /**
  91. * Source Maps
  92. */
  93. productionSourceMap: false,
  94. // https://webpack.js.org/configuration/devtool/#production
  95. devtool: '#source-map',
  96. // Gzip off by default as many popular static hosts such as
  97. // Surge or Netlify already gzip all static assets for you.
  98. // Before setting to `true`, make sure to:
  99. // npm install --save-dev compression-webpack-plugin
  100. productionGzip: false,
  101. productionGzipExtensions: ['js', 'css'],
  102. // Run the build command with an extra argument to
  103. // View the bundle analyzer report after build finishes:
  104. // `npm run build --report`
  105. // Set to `true` or `false` to always turn it on or off
  106. bundleAnalyzerReport: process.env.npm_config_report
  107. }
  108. }