Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Regarding - https://twitter.com/DavidKPiano/status/1098437300550336512 😉
When performing env checks you should never reference
process
directly - replacing plugins are only concerned with replacingprocess.env.NODE_ENV
lookup. Referencingprocess
causes i.e. webpack to include a polyfill for this object.Because of that developer-friendly warning which were meant to be removed in production bundles stayed in the bundles.
This has no dramatic effect but it allow bundlers to remove those unwanted strings in production, the UMD bundle went from 10.87 KB to 10.54 KB
In general I don't recommend storing env check result in a variable (inline check is easier for minifiers to remove), and I strongly would advise against exporting it from a file - especially given a fact that you don't flat bundle and depending on the consumer's setup it might not be possible to check this value across module-boundary.
This also provides a browser-friendly build which was actually requested originally ( #227 ) but the fix was done differently. cc @TimvdLippe