alanshaw / david-www

:eyeglasses: David helps keep your Node.js project dependencies up to date.
https://david-dm.org
MIT License
730 stars 131 forks source link

React development build is used in production #390

Closed styfle closed 6 years ago

styfle commented 6 years ago

There must be a dev build of React being included on the david-dm.org website because the react dev tools are showing the warning below:

image

Did you forget to set NODE_ENV=production environment variable?

https://github.com/styfle/react-server-example-tsx#deployment

alanshaw commented 6 years ago

The ansible scripts install node modules with the --production flag.

The postinstall script runs build and minify.

I can see that the JavaScript is minified: https://david-dm.org/bundle-23.1.0.js

Perhaps the NODE_ENV variable needs to also be set? Are you able to verify this is the case @styfle?

styfle commented 6 years ago

@alanshaw Correct, you must set NODE_ENV=production during build time to get the optimized react output or include the pre-built UMD script as an external.

See the docs here: https://reactjs.org/docs/optimizing-performance.html

blgm commented 6 years ago

You need to set NODE_ENV=production and use dead code elimination using uglifyify in order to get this warning to go away. See PR #399 for details.

alanshaw commented 6 years ago
screen shot 2018-03-03 at 14 10 55

\o/ thanks all