vue.config.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // const path = require('path')
  2. // const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
  3. module.exports = {
  4. css: {
  5. requireModuleExtension: true
  6. },
  7. publicPath: './',
  8. configureWebpack: () => ({
  9. resolve: {
  10. alias: {
  11. }
  12. },
  13. // Add package anylyze plugins
  14. // plugins: [new BundleAnalyzerPlugin()]
  15. optimization: {
  16. splitChunks: {
  17. cacheGroups: {
  18. common: {
  19. name: "chunk-common",
  20. chunks: "initial",
  21. minChunks: 2,
  22. maxInitialRequests: 5,
  23. minSize: 0,
  24. priority: 1,
  25. reuseExistingChunk: true,
  26. enforce: true
  27. },
  28. vendors: {
  29. name: "chunk-vendors",
  30. test: /[\\/]node_modules[\\/]/,
  31. chunks: "initial",
  32. priority: 2,
  33. reuseExistingChunk: true,
  34. enforce: true
  35. },
  36. elementUI: {
  37. name: "chunk-elementui",
  38. test: /[\\/]node_modules[\\/]element-ui[\\/]/,
  39. chunks: "all",
  40. priority: 3,
  41. reuseExistingChunk: true,
  42. enforce: true
  43. },
  44. threejs: {
  45. name: "chunk-threejs",
  46. test: /[\\/]three[\\/]/,
  47. chunks: "all",
  48. priority: 4,
  49. reuseExistingChunk: true,
  50. enforce: true
  51. },
  52. public: {
  53. name: "chunk-public",
  54. test: /[\\/]public[\\/]/,
  55. chunks: "all",
  56. priority: 4,
  57. reuseExistingChunk: true,
  58. enforce: true
  59. }
  60. }
  61. }
  62. },
  63. devServer: {
  64. disableHostCheck: true
  65. }
  66. })
  67. };