# performance-optimization **Repository Path**: scobiser/performance-optimization ## Basic Information - **Project Name**: performance-optimization - **Description**: 性能优化相关的课程代码 - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2025-04-17 - **Last Updated**: 2025-04-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # vuebase ## Project setup ``` yarn install ``` ### Compiles and hot-reloads for development ``` yarn serve ``` ### Compiles and minifies for production ``` yarn build ``` ### Lints and fixes files ``` yarn lint ``` ### Customize configuration See [Configuration Reference](https://cli.vuejs.org/config/). ### 问题 ### reuseExistingChunk详细解释 ``` cacheGroups: { Chunk 1 : { test: / A, B, C三个模块/, name: 'Chunk 1', }, Chunk 2: { test: / B, C/, name: 'Chunk 2' } } Chunk 1 (named one): modules A, B, C Chunk 2 (named two): modules B, C { minChunks: 2, reuseExistingChunk: false // default } 它将创建一个包含公共模块B和C的新块: Chunk 1 (named one): modules A Chunk 2 (named two): no modules (removed by optimization) Chunk 3 (named one~two): modules B, C 第二种配置: { minChunks: 2, reuseExistingChunk: true } 它将重用现有块2,因为它匹配由cacheGroup选择的模块 Chunk 1 (named one): modules A Chunk 2 (named two): modules B, C ``` ### 打包优化相关 提高打包速度 减小项目体积、提高首屏加载速度 提高用户体验(骨架屏) - 去除生产环境 sourceMap - 去除 console.log 打印以及注释 - 使用 CDN 加速优化 - 对资源文件进行压缩 - 抽离公共模块 - 骨架屏 - 配置 打包分析