From 0f89961985e3450ad2c3d4aa31f8d2792b0d8ae5 Mon Sep 17 00:00:00 2001 From: Amir Zahedi Date: Wed, 11 Sep 2024 15:00:25 +1000 Subject: [PATCH] fixes ssr apps getting process.__browser__ as true --- .changeset/seven-schools-repeat.md | 5 +++++ packages/gdu/config/next.config.ts | 11 +++-------- 2 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 .changeset/seven-schools-repeat.md diff --git a/.changeset/seven-schools-repeat.md b/.changeset/seven-schools-repeat.md new file mode 100644 index 00000000..98c0fae9 --- /dev/null +++ b/.changeset/seven-schools-repeat.md @@ -0,0 +1,5 @@ +--- +'gdu': patch +--- + +fixes ssr apps getting process.__browser__ as true diff --git a/packages/gdu/config/next.config.ts b/packages/gdu/config/next.config.ts index c9998af4..fe517ac0 100644 --- a/packages/gdu/config/next.config.ts +++ b/packages/gdu/config/next.config.ts @@ -2,7 +2,7 @@ import path, { resolve } from 'path'; import Dotenv from 'dotenv-webpack'; -import { DefinePlugin, IgnorePlugin } from 'webpack'; +import { DefinePlugin } from 'webpack'; import { getGuruConfig, getProjectName } from '../lib/config'; import { isProductionBuild } from '../lib/misc'; @@ -209,7 +209,7 @@ export const createNextJSConfig = ( const env = process.env.APP_ENV || (isDev ? 'dev' : buildEnv); const isProductionSite = productionEnvs.has(process.env.APP_ENV); const guruConfig = getGuruConfig(); - const basePath = !isDev ? guruConfig?.basePath ?? '' : ''; + const basePath = guruConfig?.basePath ?? ''; return { distDir: `dist/${env}`, @@ -246,14 +246,9 @@ export const createNextJSConfig = ( ], }, webpack: (defaultConfig) => { - defaultConfig.plugins.push( - new IgnorePlugin({ - resourceRegExp: /^@newrelic\/browser-agent$/, - }), - ); defaultConfig.plugins.push( new DefinePlugin({ - 'process.__browser__': JSON.stringify(true), + 'process.__browser__': JSON.stringify(false), 'process.env.NODE_ENV': JSON.stringify( isDev ? 'development' : 'production', ),