Skip to content

Fix npm dependency resolution conflict between React 18/19#1

Merged
SMSDAO merged 4 commits intomainfrom
copilot/fix-dependency-version-mismatch
Feb 15, 2026
Merged

Fix npm dependency resolution conflict between React 18/19#1
SMSDAO merged 4 commits intomainfrom
copilot/fix-dependency-version-mismatch

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

npm was resolving react-dom@19.x due to @clerk/clerk-expo's >=18 peer dependency, conflicting with React Native 0.73/Expo 50's React 18.x requirement.

Dependency Resolution

  • Add npm overrides to pin react@18.2.0 and react-dom@18.2.0 across monorepo
  • Update @clerk/clerk-expo from ^1.0.0 to ^2.19.22 (explicit React 18 support)
  • Add react-dom@18.2.0 to mobile workspace (satisfies peer dependency for web builds)
  • Remove non-existent mdx@^2.3.0 dependency from web package

Build Configuration

  • Add webpack.config.js with ts-loader for CI workflow
  • Install webpack toolchain devDependencies

Code Quality

  • Strip UTF-8 BOM from 50+ source files (causing JSON parse failures)
// package.json (root)
{
  "overrides": {
    "react": "18.2.0",
    "react-dom": "18.2.0"
  }
}

Note: React 19 upgrade blocked on React Native/Expo ecosystem support. RN 0.73 requires React 18.x.

Original prompt

The "NodeJS with Webpack" CI job in the Algodons/algodon repository is failing due to dependency conflicts during the npm install step. The issue occurs due to the following dependency version mismatch:

  • The repository's package.json specifies react@18.2.0, while react-dom requires react at version ^19.2.1.
  • Dependency tree analysis indicates the error arises from @clerk/clerk-expo@1.2.9, which requires react >=18. However, this conflicts with the react-dom@19.2.1 requirements for react version ^19.2.1.

Steps to resolve:

  1. Update package.json dependencies to align react and react-dom versions.
  2. Address any compatibility issues stemming from dependency version changes.
  3. Replace or update any incompatible versions of packages like @clerk/clerk-expo if necessary.
  4. Update and fix existing test cases that may fail due to these changes (apply patches for missing mocks, fixtures, imports, etc.)
  5. Avoid using the --force or --legacy-peer-deps flag unless absolutely required.

Deliverables:

  • Summary of changes made, grouped by domain.
  • List of TODOs requiring human review.

Please ensure all tests pass and the CI workflow completes successfully while maintaining clean code and adherence to architecture and domain rules.

This pull request was created from Copilot chat.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 11, 2026 21:40
…clerk-expo

Co-authored-by: SMSDAO <144380926+SMSDAO@users.noreply.github.com>
Co-authored-by: SMSDAO <144380926+SMSDAO@users.noreply.github.com>
Co-authored-by: SMSDAO <144380926+SMSDAO@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix dependency conflicts in CI job due to version mismatches Fix npm dependency resolution conflict between React 18/19 Feb 11, 2026
Copilot AI requested a review from SMSDAO February 11, 2026 21:54
@SMSDAO
Copy link
Contributor

SMSDAO commented Feb 11, 2026

@copilot fix all failing test run again must pass to green.

@SMSDAO SMSDAO requested review from Copilot and removed request for SMSDAO February 13, 2026 00:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR attempts to resolve React dependency conflicts between React 18 (required by React Native 0.73/Expo 50) and React 19 (potentially pulled in by transitive dependencies). The changes focus on pinning React versions across the monorepo, updating Clerk authentication library, adding webpack tooling for CI validation, and removing UTF-8 BOM characters from source files.

Changes:

  • Added npm overrides to force React 18.2.0 and react-dom 18.2.0 across all workspaces
  • Updated @clerk/clerk-expo and added react-dom to mobile workspace
  • Added webpack configuration and toolchain for CI build validation
  • Stripped UTF-8 BOM from 50+ source files to prevent JSON parse errors

Reviewed changes

Copilot reviewed 56 out of 57 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
package.json Added npm overrides for React version pinning, added webpack/ts-loader devDependencies
mobile/package.json Updated @clerk/clerk-expo to ^2.19.22, added react-dom 18.2.0 for web builds
web/package.json Pinned React versions to exact 18.2.0 (removed caret), removed non-existent mdx package
webpack.config.js New webpack configuration for CI validation workflow
web/tsconfig.json Removed UTF-8 BOM character
web/tailwind.config.js Removed UTF-8 BOM character
web/postcss.config.js Removed UTF-8 BOM character
web/next.config.js Removed UTF-8 BOM character
web/lib/**/*.ts Removed UTF-8 BOM characters from utility files
web/components/**/*.tsx Removed UTF-8 BOM characters from React components
web/app/**/*.tsx Removed UTF-8 BOM characters from app routes and layouts
web/app/robots.ts Removed UTF-8 BOM character (file has format issues)
web/app/sitemap.ts Removed UTF-8 BOM character
web/.env.example Removed UTF-8 BOM character
shared/types/index.ts Removed UTF-8 BOM character
desktop/package.json Removed UTF-8 BOM character
Comments suppressed due to low confidence (1)

web/app/robots.ts:7

  • This file appears to be formatted as a plain robots.txt file, but in Next.js app directory, robots.ts should be a TypeScript file that exports a function returning robot rules. This file should export a function like: export default function robots(): MetadataRoute.Robots { return { rules: { userAgent: '*', allow: '/', disallow: ['/api/', '/dashboard/', '/admin/'] }, sitemap: 'https://algodon.app/sitemap.xml' }; }. The current format will cause a build error.
User-agent: *
Allow: /
Disallow: /api/
Disallow: /dashboard/
Disallow: /admin/

Sitemap: https://algodon.app/sitemap.xml

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +22
const path = require('path');

module.exports = {
mode: 'production',
entry: './web/app/layout.tsx',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
};
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

This webpack configuration has several critical issues: (1) The entry point "./web/app/layout.tsx" is a Next.js-specific file that imports Next.js modules (Metadata, ClerkProvider, etc.) which cannot be bundled by webpack alone. (2) The file uses TypeScript path aliases like "@/components" that are not configured in webpack's resolve.alias. (3) There is no tsconfig.json at the root level for ts-loader to use. This configuration will fail during the webpack build step in the CI workflow. Consider creating a simpler entry point specifically for CI validation or configure webpack properly with all necessary loaders, plugins, and path resolution.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot apply changes on based feedback

@SMSDAO SMSDAO marked this pull request as ready for review February 15, 2026 03:42
@SMSDAO SMSDAO requested a review from Copilot February 15, 2026 03:43
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 56 out of 57 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to 4
User-agent: *
Allow: /
Disallow: /api/
Disallow: /dashboard/
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

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

web/app/robots.ts contains raw robots.txt directives, which is not valid TypeScript. This will break tsc/next build for the web app. Either rename this to web/app/robots.txt, or convert it to a proper Next.js robots.ts implementation that exports a MetadataRoute.Robots object/function.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@SMSDAO SMSDAO Feb 15, 2026

Choose a reason for hiding this comment

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

@copilot Either rename this to web/app/robots.txt, or convert it to a proper Next.js robots.ts implementation that exports a MetadataRoute.Robots object/function.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 56 out of 57 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to 4
User-agent: *
Allow: /
Disallow: /api/
Disallow: /dashboard/
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

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

This file contains raw robots.txt directives but has a .ts extension, which is invalid TypeScript syntax. This will break TypeScript compilation and Next.js builds.

For Next.js App Router, this should either be:

  1. Renamed to robots.txt and moved to the public directory, OR
  2. Converted to a proper Next.js robots.ts file that exports a MetadataRoute.Robots object or function.

Example of proper Next.js robots.ts format:

import { MetadataRoute } from 'next';

export default function robots(): MetadataRoute.Robots {
  return {
    rules: {
      userAgent: '*',
      allow: '/',
      disallow: ['/api/', '/dashboard/', '/admin/'],
    },
    sitemap: 'https://algodon.app/sitemap.xml',
  };
}

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot convert to proper next.js

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 56 out of 57 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +4 to +6
mode: 'production',
entry: './web/app/layout.tsx',
output: {
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

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

This webpack config is unlikely to succeed in CI: the entry ./web/app/layout.tsx is a Next.js App Router file that imports Next-specific modules and CSS (./styles/globals.css). With only ts-loader configured (and no CSS loader / Next-specific handling), npx webpack will fail to resolve/compile these imports.

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +18
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

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

This config also doesn't account for the TypeScript path aliases used throughout the web app (e.g. @/components/* in web/tsconfig.json) and ts-loader will look for a root tsconfig.json by default. To make npx webpack work, either point ts-loader at web/tsconfig.json and configure alias resolution (or use a separate minimal entry file without @/... imports).

Copilot uses AI. Check for mistakes.
@SMSDAO SMSDAO merged commit ef9293b into main Feb 15, 2026
24 of 27 checks passed
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