Fix Gatsby config bugs, deprecated deps, Node version, and defensive rehypeMathjax#127
Draft
Copilot wants to merge 4 commits into
Draft
Fix Gatsby config bugs, deprecated deps, Node version, and defensive rehypeMathjax#127Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
…hjax Agent-Logs-Url: https://github.com/ModelAtlasofTheEarth/website/sessions/39a3b3d6-da5f-48e5-b348-5642f74db107 Co-authored-by: julesghub <13825704+julesghub@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Gatsby config issues and update packages
Fix Gatsby config bugs, deprecated deps, Node version, and defensive rehypeMathjax
Apr 22, 2026
…config-errors [WIP] Fix issues in gatsby-config.js
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.
Several build-breaking misconfigurations and deprecated packages on the
Yu-2025-granulitesbranch were preventing successful Netlify deployment.gatsby-config.jsgatsby-plugin-sass: movedsassOptionsinsideoptions(was ignored/erroring at wrong nesting level)react-copy-to-clipboard: removed frompluginsarray — it's a React component library, not a Gatsby plugingatsby-plugin-google-gtag: moved from insidegatsby-transformer-remark.plugins(invalid there) to the top-level plugins arraypackage.json@citation-js/plugin-doi—require()d ingatsby-node.jsbut absent, causing a runtime crashsass(Dart Sass); removednode-sass(abandoned, fails on modern Node)gatsby-image— fully deprecated since Gatsby v4;gatsby-plugin-imagealready presentprettier^2.8.7→^3.0.0netlify.tomlNODE_VERSION"18"→"20"(Node 18 hit EOL April 2025)src/templates/model.jsExtracted a shared module-level constant with a defensive null guard to replace five repeated inline plugin arrays:
Original prompt
Overview
Apply a set of fixes to the
Yu-2025-granulitesbranch targeting broken Gatsby config, deprecated packages, Node version, and a defensive fix torehypeMathjaxusage insrc/templates/model.js. Create all changes on a new branch calledjulesghub/fixes26.1.
gatsby-config.js— Three bugs to fixa) Remove
react-copy-to-clipboardfrom the plugins array (line 25)react-copy-to-clipboardis a React component library, not a Gatsby plugin. It must be removed from thepluginsarray entirely. It can still be imported directly in React components.b) Move
gatsby-plugin-google-gtagout ofgatsby-transformer-remarkCurrently
gatsby-plugin-google-gtagis nested inside thepluginsarray ofgatsby-transformer-remark(lines 34–45). Remark plugins are only for Markdown transformation — Gatsby lifecycle plugins are invalid there. Move it to the top-levelpluginsarray:c) Fix
gatsby-plugin-sassoptions nesting (lines 8–10)sassOptionsmust be inside anoptionsobject:2.
package.json— Dependency fixes@citation-js/plugin-doitodependencies— it isrequire()d ingatsby-node.jsline 6 but missing frompackage.json, causing a runtime crash.gatsby-image— fully deprecated since Gatsby v4;gatsby-plugin-imageis already present.node-sass— abandoned package; replace withsass(Dart Sass, drop-in replacement forgatsby-plugin-sass).sasstodependencies.prettierindevDependenciesfrom^2.8.7to^3.0.0.3.
netlify.toml— Node versionUpgrade
NODE_VERSIONfrom"18"(EOL since April 2025) to"20":4.
src/templates/model.js— DefensiverehypeMathjaxrenderingEvery
<Markdown>component in this file currently has:Replace all occurrences with a conditional guard so it degrades gracefully if
rehypeMathjaxis falsy:There are multiple occurrences across the file (lines ~166, ~220, ~310, ~371, ~389). Update all of them.
Summary of files to change
gatsby-config.jsreact-copy-to-clipboardfrom plugins; movegatsby-plugin-google-gtagto top-level; fixgatsby-plugin-sassoptions nestingpackage.json@citation-js/plugin-doiandsass; removegatsby-imageandnode-sass; upgradeprettierto v3netlify.tomlNODE_VERSION = "20"src/templates/model.jsrehypePlugins={[[rehypeMathjax, ...]]}with conditionalrehypePlugins={rehypeMathjax ? [[rehypeMathjax, { svg: { scale: 1.0 } }]] : []}The following is the prior conversation context from the user's chat exploration (may be truncated):
User: What is a good strategy to take an out of date website repository (https://github.com/ModelAtlasofTheEarth/website/tree/Yu-2025-granulites), for gatsby, deployment via Netlify, and get it up to date.
I want to:
Assistant: Now I have a clear picture. Let me analyze everything I found.
Assistant: Now I have a comprehensive view of the repo. Here's a thorough breakdown of every issue found and the strategy to fix them.
Analysis & Fix Strategy
🔴 Critical Bugs (Will Break the Build)
1.
react-copy-to-clipboardlisted as a Gatsby plugin —gatsby-config.jsline 25This is a React component library, not a Gatsby plugin. Listing it in the
pluginsarray causes Gatsby to try to resolve its lifecycle hooks and fail.Simply delete it. The component itself is still importable in your React code from the package — it doesn't need to be registered as a plugin.
2.
gatsby-plugin-google-gtagnested insidegatsby-transformer-remark—gatsby-config.jslines 34–45Remark plugins only handle Markdown transformation — Gatsby lifecycle plugins like
gatsby-plugin-google-gtagare invalid there. Gatsby silently ignores or throws on this.