index.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. const host = require("../src/request/host");
  6. module.exports = {
  7. dev: {
  8. // 新加的一行
  9. env: require("./dev.env"),
  10. // Paths
  11. assetsSubDirectory: "static",
  12. assetsPublicPath: "/",
  13. proxyTable: {
  14. "/service": {
  15. //自定义名字,代表的是以下target中的内容
  16. target: host.host + "/service/", //微信
  17. // target: 'http://weixintest.ngser.dashitech.com/service/',//微信
  18. // target: 'http://192.168.3.100:8080/service/',//微信
  19. // target: 'http://localhost/service/',//微信
  20. changeOrigin: true, //是否允许跨域
  21. pathRewrite: {
  22. "^/service": ""
  23. }
  24. }
  25. },
  26. // Various Dev Server settings
  27. host: "0.0.0.0", // can be overwritten by process.env.HOST
  28. // host: '192.168.3.170', // can be overwritten by process.env.HOST
  29. // host: '192.168.31.32', // can be overwritten by process.env.HOST
  30. // host: '192.168.31.32', // can be overwritten by process.env.HOST
  31. // host: '0.0.0.0', // can be overwritten by process.env.HOST
  32. port: 8081, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
  33. // 住了的4行
  34. autoOpenBrowser: true,
  35. // errorOverlay: true,
  36. // notifyOnErrors: true,
  37. // poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
  38. /**
  39. * Source Maps
  40. */
  41. // https://webpack.js.org/configuration/devtool/#development
  42. // 住了一行
  43. devtool: "source-map",
  44. // If you have problems debugging vue-files in devtools,
  45. // set this to false - it *may* help
  46. // https://vue-loader.vuejs.org/en/options.html#cachebusting
  47. // 住了的
  48. // cacheBusting: true,
  49. cssSourceMap: true
  50. },
  51. build: {
  52. // Template for index.html
  53. index: path.resolve(__dirname, "../dist/index.html"),
  54. // Paths
  55. assetsRoot: path.resolve(__dirname, "../dist"),
  56. assetsSubDirectory: "static",
  57. assetsPublicPath: "./",
  58. /**
  59. * Source Maps
  60. */
  61. productionSourceMap: false, // 把该项的配置修改为 false,关闭 source map
  62. // https://webpack.js.org/configuration/devtool/#production
  63. devtool: "#source-map",
  64. // Gzip off by default as many popular static hosts such as
  65. // Surge or Netlify already gzip all static assets for you.
  66. // Before setting to `true`, make sure to:
  67. // npm install --save-dev compression-webpack-plugin
  68. productionGzip: false, // 开启 gzip 功能, 开启 GZIP 压缩,进一步压缩 js 和 css 文件的体积
  69. productionGzipExtensions: ["js", "css"],
  70. // Run the build command with an extra argument to
  71. // View the bundle analyzer report after build finishes:
  72. // `npm run build --report`
  73. // Set to `true` or `false` to always turn it on or off
  74. bundleAnalyzerReport: process.env.npm_config_report
  75. }
  76. };