diff --git a/apps/studio/routes/__root.tsx b/apps/studio/routes/__root.tsx
index 5f806a4a0a9..2bc92727fb5 100644
--- a/apps/studio/routes/__root.tsx
+++ b/apps/studio/routes/__root.tsx
@@ -35,6 +35,7 @@ import { GlobalErrorBoundaryState } from '@/components/ui/ErrorBoundary/GlobalEr
import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
import { AuthProvider } from '@/lib/auth'
import { API_URL, IS_PLATFORM, useDefaultProvider } from '@/lib/constants'
+import { ProfileProvider } from '@/lib/profile'
interface RouterContext {
queryClient: QueryClient
@@ -105,7 +106,9 @@ function RootComponent() {
enabled={IS_PLATFORM}
getConfigCatFlags={getConfigCatFlags}
>
-
+
+
+
diff --git a/apps/studio/vite.config.ts b/apps/studio/vite.config.ts
index 335c2107df8..5e5fdfe41a2 100644
--- a/apps/studio/vite.config.ts
+++ b/apps/studio/vite.config.ts
@@ -56,7 +56,11 @@ export default defineConfig({
tsconfigPaths: true,
},
ssr: {
- noExternal: ['lodash'],
+ // `lodash` is CJS; its named-export interop fails in Node ESM unless bundled.
+ // `next/*` must be bundled so our nextCompat shim wins — otherwise Vite's
+ // SSR externalizer leaves `next/router` as a runtime package import and
+ // Node resolves it to Next's real module.
+ noExternal: ['lodash', /^next(\/|$)/],
},
plugins: [
nextCompat(),