React Vue Files in Public Folder Not Processed

Today I learned something simple… but powerful. In React & Vue apps, anything you put inside the public folder gets copied as-is into the final build (dist or build folder). No bundling. No optimization. No magic. At first, I thought everything goes through the build pipeline… but that’s not true 👇 - Files in src → processed, optimized, bundled - Files in public → directly copied #React #Vue #WebDevelopment #JavaScript #Frontend #TIL #Programming

But remember:→ Use public/ only for files that need a fixed URL (like favicons). → For most JS/JSON/assets used in your components → put them in src/ and import them instead.This way you get optimization, tree-shaking, and cache-busting.

Like
Reply

most devs dump everything in public without realizing it kills performance. the real cost isn't file size, it's losing tree-shaking, minification, and code-splitting entirely. a 50kb asset in public hits way different than bundled

See more comments

To view or add a comment, sign in

Explore content categories