What is the difference between build and dist folder?
Asked Answered
G

3

43

As far as I know /dist is for production environments. It contains uglified and similar files. But why do we need a /build folder ?

Grin answered 28/3, 2016 at 3:8 Comment(9)
no,man……I saw that question,but it ask src and dist folder,not the sameGrin
To clarify - The answer that you accepted points to the same link as the one that I had shared. And in his answer, build means the same as src.Circular
Thanks,I've canceled,so what exactly diffs build and dist?Grin
"build" means the same as "dist" or "dest". That is why i said it is a duplicate question.Circular
I've see this code in a project, path: process.env.NODE_ENV === 'production' ? './dist' : './build',' it seems they are differentGrin
in most cases, "dist" means "build". you have to understand what the programmer is trying to achieve with that code.Circular
Dist - for production minified files. Build - for additional files you create during build, i.e. test reports. But actually this is matter of style, not something deep.Unearth
I believe this question is a candidate for re-opening. There are differences between all three of the directories mentioned: "build", "src", and "dist". Daniel's answer described the difference as asked by OP and also linked to a similar, but not duplicate, question as context. For example, it is quite common for a "build" directory to contain the output of Babel compilation, yet not be minified.Jewett
@Jewett I think you are right. This is not about the difference between src and dist - I start a reopen vote.Helli
E
42

Dist is for distribution and contains minified code. Build contains code that is not minified and not ready for production deployment.

Check this link… What is the role of src and dist folders?

Enthuse answered 28/3, 2016 at 3:16 Comment(1)
But create-react-app builds into build by default and that code is minified, right?Ommiad
K
0

Dist is stores all the files and folders that are required to host on server. Build is the final built package of files that will be deployed somewhere.

Khadijahkhai answered 29/6, 2024 at 7:7 Comment(0)
S
0

As Mentioned above Build is the final outcome of the files wrapped in a package which is used while hosting the site but the catch is the build also minifies the whole production packages and only keeps modules that is necessary for running.

Sturgeon answered 29/6, 2024 at 7:11 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.