Skip to content

Commit

Permalink
fix(plugin): local host maybe undefined (Internal Server error #16)
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyao27 committed Nov 24, 2024
1 parent 8f93fea commit 82d033b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/core/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,15 @@ export function withNextDevtools(nextConfig: NextConfig): NextConfig {
const nextRewrites = await nextConfig.rewrites?.()
if (process.env.NODE_ENV === 'production') return nextRewrites || []

const localClientHost = ip('lo') || 'localhost'
const rewrites = [
{
source: '/__next_devtools__/client/:path*',
destination: `http://${ip('lo')}:${localClientPort}/__next_devtools__/client/:path*`,
destination: `http://${localClientHost}:${localClientPort}/__next_devtools__/client/:path*`,
},
{
source: '/__next_devtools__/static/:path*',
destination: `http://${ip('lo')}:${staticServerPort}/:path*`,
destination: `http://${localClientHost}:${staticServerPort}/:path*`,
},
]
if (Array.isArray(nextRewrites)) {
Expand Down

0 comments on commit 82d033b

Please sign in to comment.