refactor: Replace direct process.env.NODE_ENV checks with IS_PROD and IS_DEV constants. (#30383)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Asuka Minato <i@asukaminato.eu.org>
This commit is contained in:
yyh
2025-12-31 08:32:55 +08:00
committed by GitHub
parent 6ca44eea28
commit 69589807fd
6 changed files with 15 additions and 11 deletions

View File

@ -3,7 +3,7 @@ import type { FC } from 'react'
import { headers } from 'next/headers'
import Script from 'next/script'
import * as React from 'react'
import { IS_CE_EDITION } from '@/config'
import { IS_CE_EDITION, IS_PROD } from '@/config'
export enum GaType {
admin = 'admin',
@ -32,7 +32,7 @@ const GA: FC<IGAProps> = ({
if (IS_CE_EDITION)
return null
const cspHeader = process.env.NODE_ENV === 'production'
const cspHeader = IS_PROD
? (headers() as unknown as UnsafeUnwrappedHeaders).get('content-security-policy')
: null
const nonce = extractNonceFromCSP(cspHeader)