Repository navigation
fix: export NR_SITES from constants so it is no longer undefined - #1185
Open
akashreddy-nr wants to merge 1 commit into
Open
akashreddy-nr wants to merge 1 commit into
akashreddy-nr wants to merge 1 commit into
Conversation
The search redesign (#1097, released in 9.9.0) moved NR_SITES from GlobalHeader.js into utils/constants.js, but index.js kept re-exporting it from GlobalHeader. Since 9.9.0, `import { NR_SITES } from '@newrelic/gatsby-theme-newrelic'` has resolved to undefined. - re-export NR_SITES from utils/constants - drop the SWIFTYPE_ENGINE_KEY re-export, which was removed from constants in the SearchGPT migration and has also been undefined since - add a test that fails if any named export from the package root is undefined - fix the GlobalHeader README example (GlobalHeader.NR_SITES.IO never existed) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nandu-pns
approved these changes
Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
NR_SITEShas been exported asundefinedfrom the package root since 9.9.0. Any consumer that reads a property off it crashes at build time.Cause: the search redesign (#1097, commit
083cd831) movedNR_SITESfromGlobalHeader.jsintosrc/utils/constants.js, butindex.jskept re-exporting it from./src/components/GlobalHeader. That module only has a default export now, so webpack resolves the named re-export toundefinedand only logs a warning:yarn lintdoesn't coverindex.js, so it wasn't caught.Changes
index.js: re-exportNR_SITESfrom./src/utils/constants.index.js: drop theSWIFTYPE_ENGINE_KEYre-export. It was removed fromconstants.jsin the SearchGPT migration (c90a553d) and has also beenundefinedsince. No repo in thenewrelicorg imports it.src/__tests__/exports.test.js: fails if any named export from the package root isundefined, so this class of bug fails CI next time. Without the fix it fails onNR_SITESandSWIFTYPE_ENGINE_KEY; with the fix it passes.GlobalHeaderexample usedGlobalHeader.NR_SITES.IO, which never existed. It now showsimport { GlobalHeader, NR_SITES }andNR_SITES.DOCS.Impact on consumers
src/layouts/MainLayout.jsusesNR_SITES.DEVELOPER): broken on every theme version from 9.9.0. With this fix,NR_SITES.DEVELOPERisundefined(the key was removed in0e937839), whichGlobalHeaderaccepts, so the build succeeds. Verified with a fullgatsby buildon theme 9.18.1 plus this patch.NR_SITESorSWIFTYPE_ENGINE_KEY, so there's no behavior change.Testing
npx jest: new export test passes. 90/92 overall; the 2CodeBlock.test.jsfailures also fail on a cleandevelopand are unrelated.yarn lintand fullyarn buildpass against theme 9.18.1 with thisindex.js.Related: NR-634009. Found while testing a theme upgrade in developer-website (newrelic/developer-website#2325).
🤖 Generated with Claude Code