Skip to content

Fix Vercel build failure: TS generics in inline script#162

Merged
stuckvgn merged 3 commits intomainfrom
fix/vercel-build-failure
Apr 14, 2026
Merged

Fix Vercel build failure: TS generics in inline script#162
stuckvgn merged 3 commits intomainfrom
fix/vercel-build-failure

Conversation

@LarytheLord
Copy link
Copy Markdown
Contributor

@LarytheLord LarytheLord commented Apr 14, 2026

Summary

Fixes the Vercel deployment failure on commit 5a52d50.

  • Root cause: blog/index.astro inline <script> used TypeScript generics (querySelectorAll<HTMLButtonElement>) which esbuild on Vercel's Node version parsed as JavaScript comparison operators, causing Expected ":" but found ")".
  • Fix: Remove the unnecessary TypeScript generics — the code only accesses .dataset and .style which exist on the base Element type.
  • Also: Pin Node engine to >=22.12.0 to match Astro 6.x requirements.

Test plan

  • Verify Vercel deployment succeeds
  • Verify /blog page still renders and category filters work
  • npx astro build passes locally (confirmed)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated minimum Node.js version requirement to 22.12.0

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
c4c-campus-website Ready Ready Preview, Comment Apr 14, 2026 3:16pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

Warning

Rate limit exceeded

@stuckvgn has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 51 minutes and 18 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 51 minutes and 18 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 368007b5-829b-46a1-a5a6-2dd1ce568e2a

📥 Commits

Reviewing files that changed from the base of the PR and between 7d06099 and a7054c4.

📒 Files selected for processing (3)
  • .wokeignore
  • CLAUDE.md
  • src/pages/blog/index.astro
📝 Walkthrough

Walkthrough

Node.js minimum version requirement increased from 18.0.0 to 22.12.0 in package.json. TypeScript generic type annotations removed from document.querySelectorAll calls in blog filter script without altering runtime behavior.

Changes

Cohort / File(s) Summary
Node.js Engine Configuration
package.json
Updated minimum Node.js version requirement from >=18.0.0 to >=22.12.0.
Blog Filter Query Cleanup
src/pages/blog/index.astro
Removed TypeScript generic type annotations from document.querySelectorAll calls without changing runtime behavior.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: fixing a Vercel build failure caused by TypeScript generics in an inline script.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
No Hardcoded Secrets Or Credentials ✅ Passed Neither modified file contains hardcoded API keys, tokens, passwords, or credentials. Sensitive configuration is correctly sourced from environment variables.
No Speciesist Idioms ✅ Passed Modified files contain no speciesist idioms. Changes are technical updates with no prohibited language.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/vercel-build-failure
  • 🛠️ fix NAV violations: Commit on current branch
  • 🛠️ fix NAV violations: Create PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 14, 2026
Copy link
Copy Markdown
Contributor

@stuckvgn stuckvgn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the Vercel deploy failed here

The TS generics fix in blog/index.astro and the Node engine bump were correct, but they weren't the root cause of the build failure. Astro's <script> blocks compile via the classic JSX transform (React.createElement), which requires React to be in scope at runtime. 31 components across the repo had only named imports (e.g. import { useState } from 'react') or no React import at all — so Rollup couldn't link React.createElement to anything, and the browser threw ReferenceError: React is not defined at runtime.

What PR #163 did

PR #163 (#163) added import React from 'react' to all 31 affected components. Its Vercel deploy is passing. That's the fix for the underlying runtime crash.

What this PR has that #163 doesn't

This PR has two valid changes not covered by #163:

  1. Node engine bump (>=18.0.0>=22.12.0) — Astro 6.x requires Node 22; the old floor was too low
  2. TS generics removal in blog/index.astroquerySelectorAll<HTMLButtonElement> is parsed as a comparison operator by esbuild in some Node/Vercel configurations, causing Expected ":" but found ")". This is a real fix.

Recommendation

Once #163 merges, please rebase this branch onto main. With the React import issue resolved upstream, both changes here should pass CI cleanly. They're worth keeping.

…in Node version

The Vercel deployment failed with `Expected ":" but found ")"` because
esbuild on Vercel parsed TypeScript generic syntax
(`querySelectorAll<HTMLButtonElement>`) as JavaScript comparison operators
in the blog page inline `<script>` tag.

- Remove TypeScript generics from blog/index.astro inline script (not
  needed — code only uses `.dataset` and `.style` from base Element)
- Pin Node engine to >=22.12.0 to match Astro 6.x requirements and
  prevent Vercel from auto-selecting an incompatible version

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…alse positives

The no-animal-violence action recently had its suppression removed (PR #14
in the action repo, merged 2026-04-14). This exposed pre-existing scanner
false positives on files that were never introduced by this PR:

- package-lock.json: bare-abort-controller is a dependency name owned by
  upstream maintainers, not advocacy language in this codebase
- .coderabbit.yaml: quotes banned terms in instructions for CodeRabbit to
  check for — these are meta-references in a scanner config, not real usage
- .claude/rules/advocacy-domain.md: the advocacy domain doc lists prohibited
  idioms as examples of what to avoid — scanning the rulebook for the rules
  it enforces produces noise
- tests/unit/quiz-grading.test.ts: uses 'pig', 'cow', 'dog' as option IDs
  in farmed-animal quiz fixtures — domain data, not speciesist idioms

None of these files were changed by the original PR (fix/vercel-build-failure).
The .wokeignore excludes them so the scanner gates on actual violations.
- CLAUDE.md:292 - renamed tutorial quest from 'scapegoat YAML rule' to
  'blame-target YAML rule' (scapegoat is a woke-flagged term; blame-target
  is the preferred alternative)
- CLAUDE.md:348 - rewrote 'not livestock' note to avoid quoting the
  industry commodity framing inline (use 'farmed animal/s' in all campus copy)
- .wokeignore:11 - removed 'pig' from the ignore-file comment itself;
  woke scans its own exclusion files too

All violations now suppressed. Zero false-positive warnings at threshold
severity (warning) remain.
Copy link
Copy Markdown
Contributor

@stuckvgn stuckvgn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is fully green (all 5 checks pass). Adversarial review complete:

  1. The querySelectorAll generic removal is correct — inline Astro scripts are processed by esbuild which doesn't support TypeScript generic syntax in angle brackets. The code only accesses .dataset and .style which are available on HTMLElement (the runtime type), so no functional regression.

  2. Node engine >=22.12.0 was already on main before this branch's rebase — the rebased commit correctly contains only the blog/index.astro fix.

  3. .wokeignore added to resolve pre-existing false-positive scanner failures (package-lock.json dependency names, rule-definition docs quoting prohibited patterns as examples, farmed animal species names in quiz test fixtures, CLAUDE.md tutorial quest reference). These were not introduced by this PR.

  4. No speciesist idioms in the PR's changed code.

  5. Vercel preview check: success.

@stuckvgn stuckvgn merged commit 3f6f06c into main Apr 14, 2026
8 checks passed
@stuckvgn stuckvgn deleted the fix/vercel-build-failure branch April 16, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants