Skip to content

Latest commit

 

History

History
46 lines (36 loc) · 1.65 KB

File metadata and controls

46 lines (36 loc) · 1.65 KB

React Dependencies Analysis and Solution

Identified Issues

  1. Duplicate React Dependencies:

    • The root project has React ^18 as a peer dependency
    • The example folder also has React ^18 as a direct dependency
    • Both projects are using Next.js, with the example using version ^15.1.3 and the root project also using ^15.1.3
  2. Package Structure Issues:

    • The root project is a UI component library that should have React as a peer dependency (which it correctly does)
    • The example project should be using the root project as a dependency, but there's no local link setup visible

Recommended Solutions

  1. Update Example Project's package.json:

    • Remove the direct Next.js dependency from the root project since it's a UI component library
    • Update the example project to use a stable version of Next.js (version 15 is not a valid version - latest stable is 14.x)
    • Add a local link to the root project in the example's dependencies
  2. Required Changes:

    In the root package.json:

    - Remove "@types/next": "^9.0.0"
    - Remove "next": "^15.1.3"

    In the example package.json:

    {
      "dependencies": {
        "next": "^14.2.13",
        "@nodegeeks/ui-components": "file:../",
        // ... other dependencies
      }
    }
  3. Setup Instructions:

    1. First, build the root project: npm run build
    2. In the example folder, run: npm install
    3. In the example folder, run: npm link ../
    4. Start the development server: npm run dev

This should resolve the React-related compilation issues by ensuring proper dependency management and preventing duplicate React instances.