前端build产物,本质上就是:把开发阶段写的源码,经过编译、打包、压缩、优化后,生成可以部署到服务器、CDN、容器或静态资源平台上的文件。开发时我们写的是:src/ main.ts App.vue components/ views/ router/ store/ assets/但浏览器最终运行的通常不是这些源码,而是build后生成的:dist/ index.html assets/ index-a8f3c1.js index-d9c2b7.css logo-3fd21a.png也就是说,build产物是前端应用的最终交付形态。1. 为什么需要 build现代前端项目一般会用 Vue、React、TypeScript、Less、Sass、模块化语法、组件化语法等。例如 Vue 项目里会写:template div{ { title }}/div /template script setup lang="ts" const title = 'Hello Vue' /script style scoped div { color: red;