index.js 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 devConfig = require("./dev.env");
  6. const prodConfig = require("./prod.env");
  7. const buildPath = prodConfig.BUILD_PATH.replace(/'/g, "").replace(/"/g, "");
  8. module.exports = {
  9. dev: {
  10. // Paths
  11. assetsSubDirectory: "static",
  12. assetsPublicPath: "/",
  13. // Various Dev Server settings
  14. host: "0.0.0.0", // can be overwritten by process.env.HOST
  15. port: 8871, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
  16. autoOpenBrowser: false,
  17. errorOverlay: true,
  18. notifyOnErrors: true,
  19. poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
  20. /**
  21. * Source Maps
  22. */
  23. // https://webpack.js.org/configuration/devtool/#development
  24. devtool: "eval-source-map", //生成实际的文件。行数能够正确映射
  25. // devtool: "source-map",
  26. // devtool: devConfig.DEVTOOL,
  27. // If you have problems debugging vue-files in devtools,
  28. // set this to false - it *may* help
  29. // https://vue-loader.vuejs.org/en/options.html#cachebusting
  30. cacheBusting: true,
  31. cssSourceMap: false,
  32. proxyTable: JSON.parse(devConfig.PROXY_TABLE)
  33. },
  34. build: {
  35. // Template for index.html
  36. index: path.resolve(__dirname, `${buildPath}/index.html`),
  37. // Paths
  38. assetsRoot: path.resolve(__dirname, `${buildPath}`),
  39. assetsSubDirectory: "static",
  40. assetsPublicPath: "./",
  41. /**
  42. * Source Maps
  43. */
  44. productionSourceMap: true,
  45. // https://webpack.js.org/configuration/devtool/#production
  46. devtool: "#source-map",
  47. // Gzip off by default as many popular static hosts such as
  48. // Surge or Netlify already gzip all static assets for you.
  49. // Before setting to `true`, make sure to:
  50. // npm install --save-dev compression-webpack-plugin
  51. productionGzip: false,
  52. productionGzipExtensions: ["js", "css"],
  53. // Run the build command with an extra argument to
  54. // View the bundle analyzer report after build finishes:
  55. // `npm run build --report`
  56. // Set to `true` or `false` to always turn it on or off
  57. bundleAnalyzerReport: process.env.npm_config_report
  58. },
  59. theme: {
  60. // Paths
  61. assetsRoot: path.resolve(__dirname, "../themes"),
  62. assetsSubDirectory: "static",
  63. assetsPublicPath: "./",
  64. /**
  65. * Source Maps
  66. */
  67. productionSourceMap: false,
  68. // https://webpack.js.org/configuration/devtool/#production
  69. devtool: "#source-map",
  70. // Gzip off by default as many popular static hosts such as
  71. // Surge or Netlify already gzip all static assets for you.
  72. // Before setting to `true`, make sure to:
  73. // npm install --save-dev compression-webpack-plugin
  74. productionGzip: true,
  75. productionGzipExtensions: ["js", "css"],
  76. // Run the build command with an extra argument to
  77. // View the bundle analyzer report after build finishes:
  78. // `npm run build --report`
  79. // Set to `true` or `false` to always turn it on or off
  80. bundleAnalyzerReport: process.env.npm_config_report
  81. }
  82. };