Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

358
Views
Why there are separate CJS entry points (dev/prod) in React based on NODE_ENV?

When you install React in a project and look at the library code. The main (CJS) entry point is a file with the following content:

'use strict';

if (process.env.NODE_ENV === 'production') {
  module.exports = require('./cjs/react.production.min.js');
} else {
  module.exports = require('./cjs/react.development.js');
}

Obviously, when we do react-scripts start we load the react.development.js. When we create a production build of our app with react-scripts build, the webpack could still use the react.development.js file and minify it itself.

I assume that NODE_ENV is still development when we run react-scripts build.

If we're using the react.development.js all the time, then what is the point of having these two separate files?

There are many other libraries (like React) using this approach but I cannot understand why are they doing it.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!