Repository URL to install this package:
|
Version:
1.2.8 ▾
|
| .. |
| .plugins |
| bundle |
| development |
| jest |
| shell |
| .plugins |
| development |
| shell |
| README.md |
| distPackageDeps.ts |
| paths.ts |
| utils.ts |
plugins/envThese are process.env flags that you can use in your code in order to have advanced control over what is included/excluded in your bundles. For example you may only want certain parts of your code to be included/ran under certain conditions.
Any process.env.X values that are matched will be code substituted for the associated values below.
For example you may have the following in your code: if (process.env.BUILD_FLAG_IS_CLIENT === 'true') { console.log('Foo'); }
If the BUILD_FLAG_IS_CLIENT was assigned a value of false the above
code would be converted to the following by the webpack bundling
process:
if ('false' === 'true') { console.log('Foo'); }
When your bundle is built using the UglifyJsPlugin unreachable code blocks like in the example above will be removed from the bundle final output. This is helpful for extreme cases where you want to ensure that code is only included/executed on specific targets, or for
We are stringifying the values to keep them in line with the expected type of a typical process.env member (i.e. string). @see https://github.com/ctrlplusb/react-universally/issues/395