Skip to content

Conversation

@sundayonah
Copy link
Collaborator

@sundayonah sundayonah commented Dec 18, 2025

Description

This PR resolves critical build errors and dependency issues that were preventing successful production builds. The changes include:

Provide details that support your chosen implementation, including: breaking changes, alternatives considered, changes to the API, contracts etc.

References

Include any links supporting this change such as a:

  • GitHub Issue/PR number addressed or fixed e.g closes #407
  • StackOverflow post
  • Support forum thread
  • Related pull requests/issues from other repos

If there are no references, simply delete this section.

Testing

Describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this project has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.

Please include any manual steps for testing end-to-end or functionality not covered by unit/integration tests.

Also include details of the environment this PR was developed in (language/platform/browser version).

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation and tests for new/changed functionality in this PR
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not main

By submitting a PR, I agree to Paycrest's Contributor Code of Conduct and Contribution Guide.

Summary by CodeRabbit

  • Chores

    • Build/runtime config updated (webpack callback signature expanded; client build aliases and TypeScript definition files excluded).
    • Package override bumped for Solana kit.
    • Telemetry: Sentry replay integration removed.
  • Style

    • Minor code style/formatting tweaks with no behavior changes.
  • Other

    • Non-functional whitespace/file-ending edits only.

✏️ Tip: You can customize this high-level summary in your review settings.

@sundayonah sundayonah requested a review from chibie as a code owner December 18, 2025 20:58
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 18, 2025

Walkthrough

Mostly non-functional edits plus build/config updates: two library files had only trailing-newline changes; Next.js build config updates webpack callback signature, adds IgnorePlugin for .d.ts, and client-side aliases for Solana program packages; package.json pnpm override bumped; Sentry replay removed from client instrumentation; minor JSX expression simplification in a component.

Changes

Cohort / File(s) Summary
Trivial whitespace edits
app/lib/config.ts, app/lib/sanity-data.ts
Only end-of-file / trailing newline adjustments; no functional or API changes.
Next.js build config
next.config.mjs
Updated webpack callback signature to receive { webpack, isServer }; added IgnorePlugin to skip \.d\.ts$; added client-side aliases resolving @solana-program/token and @solana-program/system to false; server externals list otherwise unchanged.
Package overrides
package.json
Bumped pnpm override: @solana/kit from ^3.0.3^5.0.0. No other dependency changes.
Client instrumentation
instrumentation-client.ts
Removed Sentry replay integration and associated replay sampling settings (replays integrations and sampling config removed).
UI expression tweak
app/components/TransferForm.tsx
Simplified arrow expression for transferNetwork retrieval and added parentheses inside a recipientNetworks filter; no behavioral changes to component API.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Inspect next.config.mjs for proper use of the new webpack parameter and correctness of IgnorePlugin pattern and client aliasing.
  • Verify compatibility of @solana/kit ^5.0.0 with existing code and build tooling.
  • Confirm removal of Sentry replay left no stray references or type imports in instrumentation-client.ts.

Possibly related PRs

Suggested labels

bug

Suggested reviewers

  • chibie
  • 5ran6

Poem

"I hopped through lines both short and neat,
Nudged a newline to its proper seat,
Webpack found a lighter way to play,
Replays skipped — I munched them away,
Tiny fixes, ears up — code feels sweet 🐇"

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description follows the required template structure but is largely incomplete; the Description section states changes resolve build errors but lacks specific details about what those errors are, the implementation chosen, and breaking changes. Complete the Description section with specific details: what build errors were fixed, why the chosen implementation was selected, any breaking changes or API modifications, and alternatives considered. Also remove or fill the References section and complete the Testing section with testing instructions and environment details.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix/build errors and dependencies' is directly related to the main objectives and changes in this PR, which address build errors and dependency updates across multiple files including next.config.mjs, package.json, and instrumentation-client.ts.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/build-errors-and-dependencies

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9a5e7d5 and 8ea3b5e.

📒 Files selected for processing (2)
  • app/components/TransferForm.tsx (2 hunks)
  • next.config.mjs (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/components/TransferForm.tsx
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-12-05T02:22:28.063Z
Learnt from: Dprof-in-tech
Repo: paycrest/noblocks PR: 312
File: app/page.tsx:7-11
Timestamp: 2025-12-05T02:22:28.063Z
Learning: In Next.js 15 with React 19, components using useSearchParams() cannot be statically prerendered. When app/layout.tsx has `export const dynamic = "force-static"`, MainPageContent must be dynamically imported with ssr: false to avoid "Element type is invalid" errors during build. The dynamic import pattern `dynamic(() => import("./components/MainPageContent").then(mod => ({ default: mod.MainPageContent })), { ssr: false })` is the correct solution for this scenario in the noblocks repository.

Applied to files:

  • next.config.mjs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build (20.x)
🔇 Additional comments (2)
next.config.mjs (2)

58-58: Webpack callback signature correctly updated.

The webpack function now properly receives the webpack instance from Next.js callback parameters rather than requiring manual import. This aligns with Next.js best practices.


93-98: The client-side alias configuration syntax is correct but the rationale requires clarification.

Setting alias: false prevents webpack from bundling specified modules. However, the original comment's assertion that these are "Node.js-only packages" is inaccurate. @solana/kit is a JavaScript SDK for building Solana apps across environments like Node, the web, and React Native, indicating these packages are designed for cross-environment use.

If these packages are being excluded to prevent bundling in client builds, this should be based on actual project usage patterns (whether they're only used server-side) rather than an assumption about their compatibility. Verify:

  • Whether these modules are imported in client-side code
  • If imported, whether they cause actual runtime or bundling errors
  • Whether error handling exists for attempted client-side access

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (2)
app/lib/config.ts (1)

62-75: Consider additional placeholder patterns.

The validation function checks for common placeholder patterns, but could be more comprehensive.

🔎 Suggested additions to placeholder patterns
 function isValidProjectId(projectId: string): boolean {
   if (!projectId) return false;
   // Check for common placeholder patterns
   const placeholderPatterns = [
     /^your-project-id/i,
     /^placeholder/i,
     /^example/i,
     /^test-project/i,
     /^change-me/i,
     /^replace/i,
+    /^xxx/i,
+    /^todo/i,
+    /^fixme/i,
+    /^(my|project|id)$/i,  // Single generic words
   ];
   return !placeholderPatterns.some((pattern) => pattern.test(projectId));
 }
next.config.mjs (1)

98-111: Redundant Solana package aliasing on both client and server.

The same Solana package aliases (@solana-program/token and @solana-program/system) are set to false for both server-side (lines 98-103) and client-side (lines 106-110) builds. This duplication could be simplified.

🔎 Proposed refactor to eliminate duplication
     // Handle Mixpanel on server-side only
     if (isServer) {
       config.externals = config.externals || [];
       config.externals.push({
         mixpanel: "commonjs mixpanel",
       });
-      // SERVER-SIDE: Also exclude Solana packages
-      config.resolve.alias = {
-        ...config.resolve.alias,
-        '@solana-program/token': false,
-        '@solana-program/system': false,
-      };
-    } else {
-      // CLIENT-SIDE: Exclude problematic packages
-      config.resolve.alias = {
-        ...config.resolve.alias,
-        '@solana-program/token': false,
-        '@solana-program/system': false,
-      };
     }
+    
+    // Exclude Solana packages from both client and server builds
+    config.resolve.alias = {
+      ...config.resolve.alias,
+      '@solana-program/token': false,
+      '@solana-program/system': false,
+    };

     return config;
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eae5321 and e75ea8d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • app/lib/config.ts (1 hunks)
  • app/lib/sanity-data.ts (2 hunks)
  • next.config.mjs (5 hunks)
  • package.json (3 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-07-23T07:30:23.720Z
Learnt from: jeremy0x
Repo: paycrest/noblocks PR: 177
File: app/utils.ts:179-196
Timestamp: 2025-07-23T07:30:23.720Z
Learning: The `normalizeNetworkName` function in app/utils.ts has been updated to be dynamic and scalable, converting any network identifier to sentence case with hyphens replaced by spaces and proper handling of acronyms like "BNB".

Applied to files:

  • app/lib/config.ts
📚 Learning: 2025-12-05T02:22:28.063Z
Learnt from: Dprof-in-tech
Repo: paycrest/noblocks PR: 312
File: app/page.tsx:7-11
Timestamp: 2025-12-05T02:22:28.063Z
Learning: In Next.js 15 with React 19, components using useSearchParams() cannot be statically prerendered. When app/layout.tsx has `export const dynamic = "force-static"`, MainPageContent must be dynamically imported with ssr: false to avoid "Element type is invalid" errors during build. The dynamic import pattern `dynamic(() => import("./components/MainPageContent").then(mod => ({ default: mod.MainPageContent })), { ssr: false })` is the correct solution for this scenario in the noblocks repository.

Applied to files:

  • next.config.mjs
🧬 Code graph analysis (1)
app/lib/sanity-data.ts (3)
app/blog/types.ts (2)
  • SanityPost (19-29)
  • SanityCategory (13-17)
app/lib/sanity-client.ts (1)
  • client (7-10)
app/lib/sanity-queries.ts (4)
  • postsQuery (4-34)
  • postQuery (37-64)
  • recentPostsQuery (67-89)
  • categoriesQuery (92-98)
🔇 Additional comments (7)
next.config.mjs (3)

2-4: LGTM! Proper CommonJS interop for ESM config file.

The use of createRequire is the correct approach for importing CommonJS modules (like webpack) in an ESM-based Next.js config file.


60-60: Reconsider the justification for excluding rate-limiter-flexible from bundling. The package is a pure JavaScript library with no native dependencies and bundles well with webpack. If external packaging is needed, it should be because the application uses Node.js-specific features (such as RateLimiterRedis or RateLimiterCluster) that require server-side-only execution, not due to inherent bundling incompatibility.


82-90: Verify the root cause of ignoring .d.ts files before adding webpack configuration.

Using IgnorePlugin to exclude .d.ts files is a common pattern in webpack for preventing declaration files from being bundled, but ensure this addresses an actual build issue rather than being a premature optimization. If a specific error exists, document it in the comment (e.g., "Prevents webpack from processing third-party .d.ts files that were causing bundle issues"). Otherwise, verify whether declaration files in the codebase are being incorrectly imported or if TypeScript configuration options like skipLibCheck might be a more appropriate solution.

app/lib/sanity-data.ts (2)

33-37: Good use of Next.js caching for duplicate fetch prevention.

The getCachedPosts wrapper using unstable_cache properly prevents duplicate fetches within a single render while maintaining the 300-second revalidation interval.


40-54: Most calling code properly handles null/empty returns, but verify UI feedback for empty states.

The data fetching functions safely return empty arrays or null on failure. However, the handling varies by usage location:

  • getPost() is properly checked with if (!post) guards in both call sites
  • getRecentPosts() in DetailClient correctly checks recent.length > 0 before rendering
  • getCachedPosts() in HomeClient and Sitemap passes data without verifying empty states—confirm these components provide appropriate fallback UI when no content is available
  • getCategories() similarly needs verification that HomeClient displays gracefully with no categories
app/lib/config.ts (1)

50-60: Clarify Sanity project ID format before sanitization logic.

The function allows dashes in sanitized project IDs, but all Sanity project ID examples in official documentation (e.g., "o0o3tm7x", "abc123") contain only lowercase letters and numbers. If project IDs don't actually support dashes, the regex /[a-z0-9]+([-][a-z0-9]+)*/ should be replaced with /[a-z0-9]/. Verify against Sanity's project creation API or documentation to confirm the exact character restrictions.

package.json (1)

55-55: Clarify the necessity and purpose of module interception library dependencies.

The additions of import-in-the-middle and require-in-the-middle are module interception libraries typically used for APM tools like OpenTelemetry or dynamic patching, but they are not referenced anywhere in the codebase. The PR description should explain why these dependencies are required to fix the stated build errors, or confirm whether they are transitive dependencies that should be installed automatically.

Comment on lines 11 to 30
// Fetch all posts (returns empty array if Sanity is not configured)
export async function getPosts(): Promise<SanityPost[]> {
if (!client) {
throw new Error(
"Sanity client is not configured. Check your environment variables.",
// Return empty array instead of throwing to allow builds without Sanity
return [];
}
try {
return await client.fetch(
postsQuery,
{},
{
next: { revalidate: 300 },
},
);
} catch (error) {
// If Sanity fetch fails (e.g., invalid project ID), return empty array
console.warn("Failed to fetch Sanity posts:", error);
return [];
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Silent failures may hide configuration issues during development.

The change from throwing errors to returning empty arrays allows builds to succeed even when Sanity is misconfigured. While this helps with build resilience, it could mask genuine configuration problems during development where you'd want immediate feedback.

Consider adding environment-specific behavior:

🔎 Proposed enhancement for development environment feedback
 // Fetch all posts (returns empty array if Sanity is not configured)
 export async function getPosts(): Promise<SanityPost[]> {
   if (!client) {
+    const message = "Sanity client not initialized. Check NEXT_PUBLIC_SANITY_PROJECT_ID configuration.";
+    if (process.env.NODE_ENV === "development") {
+      console.error(message);
+    } else {
+      console.warn(message);
+    }
     // Return empty array instead of throwing to allow builds without Sanity
     return [];
   }
   try {
     return await client.fetch(
       postsQuery,
       {},
       {
         next: { revalidate: 300 },
       },
     );
   } catch (error) {
-    // If Sanity fetch fails (e.g., invalid project ID), return empty array
-    console.warn("Failed to fetch Sanity posts:", error);
+    const errorMessage = "Failed to fetch Sanity posts:";
+    if (process.env.NODE_ENV === "development") {
+      console.error(errorMessage, error);
+    } else {
+      console.warn(errorMessage, error);
+    }
     return [];
   }
 }

Apply similar changes to getPost, getRecentPosts, and getCategories.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Fetch all posts (returns empty array if Sanity is not configured)
export async function getPosts(): Promise<SanityPost[]> {
if (!client) {
throw new Error(
"Sanity client is not configured. Check your environment variables.",
// Return empty array instead of throwing to allow builds without Sanity
return [];
}
try {
return await client.fetch(
postsQuery,
{},
{
next: { revalidate: 300 },
},
);
} catch (error) {
// If Sanity fetch fails (e.g., invalid project ID), return empty array
console.warn("Failed to fetch Sanity posts:", error);
return [];
}
}
// Fetch all posts (returns empty array if Sanity is not configured)
export async function getPosts(): Promise<SanityPost[]> {
if (!client) {
const message = "Sanity client not initialized. Check NEXT_PUBLIC_SANITY_PROJECT_ID configuration.";
if (process.env.NODE_ENV === "development") {
console.error(message);
} else {
console.warn(message);
}
// Return empty array instead of throwing to allow builds without Sanity
return [];
}
try {
return await client.fetch(
postsQuery,
{},
{
next: { revalidate: 300 },
},
);
} catch (error) {
const errorMessage = "Failed to fetch Sanity posts:";
if (process.env.NODE_ENV === "development") {
console.error(errorMessage, error);
} else {
console.warn(errorMessage, error);
}
return [];
}
}
🤖 Prompt for AI Agents
In app/lib/sanity-data.ts around lines 11 to 30, the current getPosts() swallows
errors and returns an empty array which can hide Sanity misconfiguration during
development; update error handling to be environment-aware: in development
(NODE_ENV === "development" or a dedicated env flag) rethrow or throw a new
error after logging so developers see failures immediately, while in production
log the error and return an empty array to keep builds resilient; apply the same
environment-aware pattern to getPost, getRecentPosts, and getCategories so all
Sanity fetch helpers surface errors during development but remain tolerant in
production.

"react": "^19.0.1",
"react-dom": "^19.0.1"
"react-dom": "^19.0.1",
"@solana/kit": "^5.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check package.json for @solana/kit and pnpm overrides
echo "=== Checking package.json around line 116 for @solana/kit ==="
sed -n '100,130p' package.json

echo -e "\n=== Checking for pnpm overrides section in package.json ==="
cat package.json | grep -A 20 "\"pnpm\""

echo -e "\n=== Checking next.config.mjs for Solana packages ==="
cat next.config.mjs | grep -i "solana" -B 3 -A 3

echo -e "\n=== Searching for @solana/kit imports in TypeScript/JavaScript files ==="
find . -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" \) ! -path "*/node_modules/*" ! -path "*/.next/*" -exec grep -l "@solana/kit" {} \; | head -20

Repository: paycrest/noblocks

Length of output: 1906


Remove the @solana/kit override or update to a valid version.

The pnpm override for @solana/kit": "^5.0.0" specifies a non-existent package version and is not used anywhere in the codebase. Either remove it if @solana/kit usage is not planned, or update to a valid version (current latest is 3.0.3) if it will be integrated. The related next.config.mjs excludes @solana-program/* packages, not @solana/kit, suggesting this override may have been added in error.

🤖 Prompt for AI Agents
In package.json around line 116, the pnpm override entry "@solana/kit": "^5.0.0"
references a non-existent version; either delete this override if @solana/kit is
not used, or replace it with a valid released version (e.g. "3.0.3") and run
pnpm install to update the lockfile; ensure any change is reflected in
package.json's pnpm.overrides block and remove any stray exclusions for
unrelated packages in next.config.mjs if this override was added by mistake.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e75ea8d and bdc54fb.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • app/lib/config.ts (1 hunks)
  • package.json (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • package.json
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-07-23T07:30:23.720Z
Learnt from: jeremy0x
Repo: paycrest/noblocks PR: 177
File: app/utils.ts:179-196
Timestamp: 2025-07-23T07:30:23.720Z
Learning: The `normalizeNetworkName` function in app/utils.ts has been updated to be dynamic and scalable, converting any network identifier to sentence case with hyphens replaced by spaces and proper handling of acronyms like "BNB".

Applied to files:

  • app/lib/config.ts
🔇 Additional comments (3)
app/lib/config.ts (3)

62-75: LGTM!

The validation logic correctly filters out common placeholder patterns and empty values. The case-insensitive regex patterns cover typical placeholder text effectively.


78-80: Consistent validation applied - past concern resolved.

The client config now properly sanitizes and validates the project ID before use. This addresses the previous review comment about inconsistent validation between client and server configs. Both configs now follow the same pattern of sanitization followed by validation.


87-89: Server config validation implemented - consistency achieved.

The server config now uses the same sanitization and validation pattern as the client config, directly addressing the concern raised in the previous review. Both configs will now consistently reject placeholder or invalid project IDs.

Dprof-in-tech
Dprof-in-tech previously approved these changes Dec 19, 2025
Copy link
Collaborator

@Dprof-in-tech Dprof-in-tech left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
next.config.mjs (1)

2-4: Consider using Next.js built-in webpack or direct ESM import.

The createRequire pattern works but adds complexity. Next.js webpack config functions can import webpack directly via ESM (import webpack from 'webpack') or access it through the context object, eliminating the need for CommonJS interop.

🔎 Simpler alternative using direct ESM import
-import { createRequire } from "module";
-
-const require = createRequire(import.meta.url);
+import webpack from "webpack";

Then remove line 62:

  webpack: (config, { isServer }) => {
-    const webpack = require("webpack");
-

Also applies to: 62-62

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e3d850 and 597b711.

📒 Files selected for processing (5)
  • app/components/TransferForm.tsx (3 hunks)
  • app/lib/config.ts (1 hunks)
  • app/lib/sanity-data.ts (1 hunks)
  • next.config.mjs (5 hunks)
  • package.json (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • app/lib/sanity-data.ts
  • app/components/TransferForm.tsx
  • app/lib/config.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • package.json
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-12-05T02:22:28.063Z
Learnt from: Dprof-in-tech
Repo: paycrest/noblocks PR: 312
File: app/page.tsx:7-11
Timestamp: 2025-12-05T02:22:28.063Z
Learning: In Next.js 15 with React 19, components using useSearchParams() cannot be statically prerendered. When app/layout.tsx has `export const dynamic = "force-static"`, MainPageContent must be dynamically imported with ssr: false to avoid "Element type is invalid" errors during build. The dynamic import pattern `dynamic(() => import("./components/MainPageContent").then(mod => ({ default: mod.MainPageContent })), { ssr: false })` is the correct solution for this scenario in the noblocks repository.

Applied to files:

  • next.config.mjs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build (20.x)
🔇 Additional comments (1)
next.config.mjs (1)

60-60: Remove rate-limiter-flexible from serverExternalPackages.

The package is pure JavaScript without native dependencies or Node.js-specific features and does not require external handling. It works correctly when bundled by Next.js.

Likely an incorrect or invalid review comment.

Comment on lines +82 to +90
// Exclude TypeScript definition files from being processed
if (!config.plugins) {
config.plugins = [];
}
config.plugins.push(
new webpack.IgnorePlugin({
resourceRegExp: /\.d\.ts$/,
})
);
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Document what specific build error this .d.ts IgnorePlugin solves.

TypeScript loaders generate .d.ts files that should be ignored in watch mode to prevent infinite watch loops, but blanket ignoring all .d.ts files in the webpack config is unusual. This IgnorePlugin will prevent legitimate TypeScript definition imports from being processed. Please add a comment explaining:

  • What specific build error this was added to fix
  • Which dependency triggered the issue
  • Whether the root cause could be better addressed (e.g., through package resolution or reporting upstream)

Without this context, the fix appears to be masking a deeper configuration problem rather than solving the underlying issue.

🤖 Prompt for AI Agents
In next.config.mjs around lines 82 to 90, the IgnorePlugin that skips all
`.d.ts` files needs a clear comment and a safer scope: document the exact build
error it fixes (e.g., "infinite watch-loop or EMFILE/file-watcher errors caused
by <dependency-name> generating .d.ts during build"), name the dependency that
triggered the issue, and note whether this is a workaround vs. a root-cause fix;
then narrow the IgnorePlugin to only the offending paths or apply it only in
watch mode (or prefer fixing package resolution/upstream) and add the
explanatory comment describing the specific error, dependency, and recommended
long-term remediation.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
next.config.mjs (1)

82-90: Document the specific build error this IgnorePlugin solves.

As flagged in a previous review, blanket ignoring all .d.ts files is unusual and could prevent legitimate TypeScript definition imports from being processed. The generic comment on Line 82 doesn't explain what specific build error necessitated this plugin.

Please add inline documentation that includes:

  • The exact build error message or symptom (e.g., "EMFILE error", "infinite watch loop", "memory exhaustion")
  • The specific dependency that triggered the issue
  • Whether this is a temporary workaround or the intended long-term solution
  • Consider scoping the IgnorePlugin to specific paths rather than all .d.ts files

Without this context, the fix appears to mask a configuration issue rather than addressing the root cause.

#!/bin/bash
# Search for dependencies that might generate .d.ts files during build

echo "=== Checking for TypeScript-related build plugins ==="
rg -n "ts-loader|@swc/core|esbuild|babel.*typescript" package.json || echo "No TypeScript build plugins found"

echo -e "\n=== Looking for dependencies that might generate .d.ts at runtime ==="
rg -n "declaration|emitDeclarationOnly" --type json || echo "No declaration generation config found"

echo -e "\n=== Checking for any references to .d.ts issues in recent commits ==="
git log --all --oneline --grep="d\.ts\|definition\|type.*error" -i -20 2>/dev/null || echo "Git history not available"
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 597b711 and 1971c9f.

📒 Files selected for processing (1)
  • next.config.mjs (5 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Dprof-in-tech
Repo: paycrest/noblocks PR: 312
File: app/page.tsx:7-11
Timestamp: 2025-12-05T02:22:28.063Z
Learning: In Next.js 15 with React 19, components using useSearchParams() cannot be statically prerendered. When app/layout.tsx has `export const dynamic = "force-static"`, MainPageContent must be dynamically imported with ssr: false to avoid "Element type is invalid" errors during build. The dynamic import pattern `dynamic(() => import("./components/MainPageContent").then(mod => ({ default: mod.MainPageContent })), { ssr: false })` is the correct solution for this scenario in the noblocks repository.
📚 Learning: 2025-12-05T02:22:28.063Z
Learnt from: Dprof-in-tech
Repo: paycrest/noblocks PR: 312
File: app/page.tsx:7-11
Timestamp: 2025-12-05T02:22:28.063Z
Learning: In Next.js 15 with React 19, components using useSearchParams() cannot be statically prerendered. When app/layout.tsx has `export const dynamic = "force-static"`, MainPageContent must be dynamically imported with ssr: false to avoid "Element type is invalid" errors during build. The dynamic import pattern `dynamic(() => import("./components/MainPageContent").then(mod => ({ default: mod.MainPageContent })), { ssr: false })` is the correct solution for this scenario in the noblocks repository.

Applied to files:

  • next.config.mjs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build (20.x)
🔇 Additional comments (2)
next.config.mjs (2)

129-137: LGTM! Development-only image source correctly restricted.

The conditional inclusion of picsum.photos only in non-production environments is a security best practice, preventing unnecessary external image sources in production.


98-103: The Solana package aliases are correctly implemented.

The client-side aliases are necessary and properly configured. Setting resolve.alias to false tells webpack to ignore a module. Verification confirms that:

  • @solana-program/token is a JavaScript client for the Token program and is a direct dependency (version 0.6.0 in package.json)
  • @solana-program/system is a transitive dependency pulled in by @privy-io/react-auth, which depends on both packages

Both packages are client-side dependencies used by the Privy auth library, so they correctly require alias: false to prevent webpack bundling them in the browser. They should not be added to serverExternalPackages since they're only used client-side and aren't meant to be loaded at runtime on the server.

@@ -55,6 +59,8 @@ const nextConfig = {
},
serverExternalPackages: ["mixpanel", "https-proxy-agent", "rate-limiter-flexible"],
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify rate-limiter-flexible usage in the repository

echo "=== Checking package.json for rate-limiter-flexible ==="
if [ -f package.json ]; then
  jq '.dependencies["rate-limiter-flexible"], .devDependencies["rate-limiter-flexible"]' package.json
else
  echo "package.json not found"
fi

echo -e "\n=== Searching for rate-limiter-flexible imports ==="
rg -n "rate-limiter-flexible|RateLimiter" --type ts --type tsx --type js --type jsx 2>/dev/null | head -20 || echo "No imports found"

echo -e "\n=== Checking next.config.mjs for context ==="
if [ -f next.config.mjs ]; then
  sed -n '55,65p' next.config.mjs
else
  echo "next.config.mjs not found"
fi

Repository: paycrest/noblocks

Length of output: 598


Remove unused rate-limiter-flexible dependency and from serverExternalPackages.

The package is listed in dependencies but no imports or usage were found in the codebase. While rate-limiter-flexible is a Node.js package for rate limiting, it should not be configured in serverExternalPackages if it's not actually used. Remove it from both package.json and the serverExternalPackages array in next.config.mjs to avoid unnecessary bloat.

🤖 Prompt for AI Agents
In next.config.mjs around line 60 remove "rate-limiter-flexible" from the
serverExternalPackages array and also remove the dependency from package.json;
uninstall the package (npm/yarn/pnpm remove rate-limiter-flexible), update the
lockfile by reinstalling dependencies, and run the test/build to ensure nothing
breaks after the change.

Copy link
Contributor

@5ran6 5ran6 left a comment

Choose a reason for hiding this comment

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

LGTM. Could you just address the comment I raised?

…lace img with Image component in TransferForm
@5ran6 5ran6 merged commit a1ded20 into main Dec 19, 2025
1 of 2 checks passed
@5ran6 5ran6 deleted the fix/build-errors-and-dependencies branch December 19, 2025 22:11
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.

3 participants