As far as I know /dist
is for production environments. It contains uglified and similar files. But why do we need a /build
folder ?
Asked
Active
Viewed 2.2k times
34
-
12no,man……I saw that question,but it ask src and dist folder,not the same – markjiang Mar 28 '16 at 04:06
-
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. – codemax Mar 28 '16 at 04:10
-
Thanks,I've canceled,so what exactly diffs build and dist? – markjiang Mar 28 '16 at 04:14
-
"build" means the same as "dist" or "dest". That is why i said it is a duplicate question. – codemax Mar 28 '16 at 04:20
-
3I've see this code in a project, `path: process.env.NODE_ENV === 'production' ? './dist' : './build','` it seems they are different – markjiang Mar 28 '16 at 04:24
-
in most cases, "dist" means "build". you have to understand what the programmer is trying to achieve with that code. – codemax Mar 28 '16 at 04:27
-
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. – Petr Averyanov Mar 28 '16 at 12:54
-
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. – alanning May 03 '19 at 16:28
-
1@alanning I think you are right. This is not about the difference between src and dist - I start a reopen vote. – Blackbam Jun 16 '20 at 11:18
1 Answers
35
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?

Community
- 1
- 1

Daniel Humfleet
- 509
- 3
- 5
-
But create-react-app builds into `build` by default and that code is minified, right? – Florian Walther Dec 11 '22 at 09:35