-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
warn user when using minified code outside of NODE_ENV 'production'
- Loading branch information
1 parent
9c35fd6
commit 554e8d9
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* This is a function that exists for the function isMinifiedOutsideOfProduction to perform a check. | ||
* If this function does not maintain its name and the NODE_ENV is not === 'production' | ||
* then we know the user is using minified code outside of production and we should warn | ||
*/ | ||
function isCrushed() { | ||
return true | ||
} | ||
/** | ||
* Function that checks name of isCrushed and NODE_ENV | ||
* to determine if code is minified outside of production | ||
* | ||
* @returns {Boolean} A boolean value that is based on whether or not code | ||
* has been minifed outside side of NODE_ENV === 'production' | ||
*/ | ||
export default function isMinifiedOutsideOfProduction() { | ||
return isCrushed.name !== 'isCrushed' && process.env.NODE_ENV !== 'production' | ||
} |