Compiled apps use development version of react and react-dom
See original GitHub issuePrerequisites
- Using yarn
- Using node 10.x
- Using an up-to-date
master
branch - Using latest version of devtools. See wiki for howto update
- Link to stacktrace in a Gist (for bugs)
- For issue in production release, devtools output of
DEBUG_PROD=true yarn build && yarn start
- Tried solutions mentioned in #400
Expected Behavior
An app created with yarn package
will use react.production.min.js
and react-dom.production.min.js
Current Behavior
An app created with yarn package
, in vanilla git clone’s of both the master and the next branch, ships with react.development.js
and react-dom.development.js
, see screenshot below.

Possible Solution
Not found any yet, but I assume NODE_ENV gets overwritten or unset somewhere.
Steps to Reproduce (for bugs)
- fresh checkout of the repo
yarn
yarn run package
- inspect the sources of the app
Context
A compiled app should be as fast as possible, running the production version of react is very important in that context.
Your Environment
- Node version : 10
- Version or Branch used : master as well as next
- Operating System and version : mac os mojave
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:14 (4 by maintainers)
Top Results From Across the Web
CDN Links - React
Both React and ReactDOM are available over a CDN. ... The versions above are only meant for development, and are not suitable for...
Read more >Create a New React App
Create React App is a comfortable environment for learning React, and is the best way to start building a new single-page application in...
Read more >ReactDOM – React
ReactDOM. The react-dom package provides DOM-specific methods that can be used at the top level of your app and as an escape hatch...
Read more >React v16.0 – React Blog
We're excited to announce the release of React v16.0! Among the changes are some long-standing feature requests, including fragments, ...
Read more >Optimizing Performance - React
It is expected that you use the development mode when working on your app, ... We offer production-ready versions of React and React...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
yarn start
runs electron withNODE_ENV=production
prefixed, which is why that does work (though there is a comment there on lacking dead code elimination?)Thanks for the plugin above! It’s not ideal but it gets the job done! 👍
I can reproduce it using @Kilian 's test after running
yarn package
(I was usingyarn start
before, which doesn’t package the app).Here’s what seems to work for me so far:
Add the following snippet to
plugins
in the prod webpack configs:configs/webpack.config.main.prod.babel.js
configs/webpack.config.renderer.prod.babel.js
🤷♂️ kind of hacky but guarantees that the environment will be set prior to any
require
statements running