webpack.prod.js 998 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. const { merge } = require("webpack-merge");
  2. const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
  3. const common = require("./webpack.common.js");
  4. module.exports = merge(common, {
  5. mode: "production",
  6. devtool: "source-map",
  7. output: {
  8. publicPath: "/build/"
  9. },
  10. resolve: {
  11. alias: {
  12. vue: "vue/dist/vue.esm.js",
  13. styles: "src/styles"
  14. }
  15. },
  16. plugins: [
  17. new BundleAnalyzerPlugin({
  18. analyzerMode: "static"
  19. })
  20. ],
  21. optimization: {
  22. runtimeChunk: "single",
  23. splitChunks: {
  24. cacheGroups: {
  25. commons: {
  26. name: "vendors",
  27. test: /[\\/]node_modules[\\/](vue|vuex|vue-router)[\\/]/,
  28. chunks: "all"
  29. },
  30. ui: {
  31. name: false,
  32. test(module) {
  33. return (
  34. module.resource.includes("Modal.vue") ||
  35. module.resource.includes(
  36. "AddToPlaylistDropdown.vue"
  37. ) ||
  38. module.resource.includes("MainHeader.vue") ||
  39. module.resource.includes("MainFooter.vue")
  40. );
  41. },
  42. enforce: true
  43. }
  44. }
  45. }
  46. }
  47. });