- The simplest optimization we can make is to not output any statements to the console. Performing a console.log statement is not as trivial a task as you'd imagine for the framework, so it's recommended to remove all console statements when you are ready to bundle your final app.
- If you use a lot of console statements during development, you can have Babel automatically remove them when creating the bundle by using the transform-remove-console plugin. This can be installed into the project via the Terminal using yarn:
yarn add babel-plugin-transform-remove-console
- Alternatively, you can use npm:
npm install babel-plugin-transform-remove-console --save
With the package installed, you can add it to the project by adding ...