InterviewSolution
| 1. |
How Do You Tell React To Build In Production Mode And What Will That Do? |
|
Answer» Typically you’d use Webpack’s DefinePlugin method to set NODE_ENV to production. This will strip out things like propType validation and extra warnings. On top of that, it’s also a good IDEA to minify your code because REACT uses Uglify’s dead-code elimination to strip out development only code and comments, which will DRASTICALLY reduce the size of your BUNDLE. Typically you’d use Webpack’s DefinePlugin method to set NODE_ENV to production. This will strip out things like propType validation and extra warnings. On top of that, it’s also a good idea to minify your code because React uses Uglify’s dead-code elimination to strip out development only code and comments, which will drastically reduce the size of your bundle. |
|