Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fixes ssr apps getting process.__browser__ as true #266

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/seven-schools-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gdu': patch
---

fixes ssr apps getting process.__browser__ as true
11 changes: 3 additions & 8 deletions packages/gdu/config/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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}`,
Expand Down Expand Up @@ -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',
),
Expand Down
Loading