Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Commit 3c24b00

Browse files
committed
removed is dev variable because if not directly checking if the env is prod, webpack can't detect it
1 parent 653f8e7 commit 3c24b00

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

packages/core/src/logCodeManager.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
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
*/
263264
let tempLogCodeManager;
264-
if (isDev) {
265+
if (typeof process === 'object' && process.env.NODE_ENV !== 'production') {
265266
tempLogCodeManager = {
266267
getLog,
267268
log,

packages/core/src/utils.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff 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';

0 commit comments

Comments
 (0)