在实际项目中使用 React 时才发现,需要补的知识点那么多。😭
我使用 Parceljs 来打包 React 应用。
parcel build index.html
在 dist 中生成 4 个文件。
index.html
*.js
*.css
*.map
不明白 *.map 文件是做什么的,所以查了一下。 阮老师的文章: http://www.ruanyifeng.com/blog/2013/01/javascript_source_map.html
我的总结
- 开发环境,代码不压缩 + source map
- 测试环境,代码压缩 + source map
- 生产环境,代码压缩 no source map 但是小项目,对性能要求不高的项目,希望在生产环境直接查杀bug的项目。一直保留 source map也不错啊。😄😄😄