This repository was archived by the owner on Oct 16, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed
Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change 1- import { isDev } from './utils' ;
2-
31// The Log Code Manager keeps track
42// and manages all important Logs of AgileTs.
53//
@@ -165,9 +163,12 @@ const niceLogCodeMessages = {
165163 '00:03:01' : "'${0}' has to be of the type ${1}!" ,
166164} ;
167165
168- const logCodeMessages : typeof niceLogCodeMessages = isDev
169- ? niceLogCodeMessages
170- : ( { } as any ) ;
166+ // Note: Not outsource the 'production' env check,
167+ // because then webpack can't treeshake based on the current env
168+ const logCodeMessages : typeof niceLogCodeMessages =
169+ typeof process === 'object' && process . env . NODE_ENV !== 'production'
170+ ? niceLogCodeMessages
171+ : ( { } as any ) ;
171172
172173/**
173174 * Returns the log message according to the specified log code.
@@ -261,7 +262,7 @@ function logIfTags<T extends LogCodesArrayType<typeof logCodeMessages>>(
261262 * @internal
262263 */
263264let tempLogCodeManager ;
264- if ( isDev ) {
265+ if ( typeof process === 'object' && process . env . NODE_ENV !== 'production' ) {
265266 tempLogCodeManager = {
266267 getLog,
267268 log,
Original file line number Diff line number Diff line change @@ -272,6 +272,3 @@ export const runsOnServer = (): boolean => {
272272 typeof window . document . createElement !== 'undefined'
273273 ) ;
274274} ;
275-
276- export const isDev =
277- typeof process === 'object' && process . env . NODE_ENV !== 'production' ;
You can’t perform that action at this time.
0 commit comments