Skip to content

Conversation

p-stam001
Copy link

@p-stam001 p-stam001 commented Oct 7, 2025

I updated the SDK’s package.json and vite.config.ts configuration to properly support both modern bundlers and legacy environments such as Create React App (CRA).

Previously, the CRA project couldn’t resolve subpath imports like:

import { LogoutLink } from "@kinde-oss/kinde-auth-react/components";

because react-scripts (Webpack 4) doesn’t fully recognize the exports field by default.

To resolve this, I added explicit subpath definitions under "exports" and configured "typesVersions" to correctly point to the built declaration files.

Fixes #186

Copy link

coderabbitai bot commented Oct 7, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • package.json is excluded by !**/*.json

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Renamed library entry keys in vite.config.ts from "components" and "utils" to "components/index" and "utils/index". Added "react-dom" to both build.lib.external and build.rollupOptions.external to be treated as an external dependency.

Changes

Cohort / File(s) Summary
Library entry key rename
vite.config.ts
Changed build.lib.entry keys: components -> components/index, utils -> utils/index, keeping the same source paths.
External dependencies update
vite.config.ts
Added react-dom to build.lib.external and build.rollupOptions.external.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • DaveOrDead

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly conveys the main purpose of the changes by stating that it fixes a compatibility issue with CRA and react-scripts, which aligns directly with the pull request’s objective to support legacy bundlers like Create React App. It is clear, concise, and focuses on the primary change without extraneous detail.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed The author’s description clearly explains that package.json and vite.config.ts were updated to add explicit subpath exports and typesVersions support for CRA compatibility, which matches the changes in the 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.

Copy link

@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: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 975d483 and 8a8d603.

⛔ Files ignored due to path filters (1)
  • package.json is excluded by !**/*.json
📒 Files selected for processing (1)
  • vite.config.ts (2 hunks)
🔇 Additional comments (2)
vite.config.ts (2)

42-42: LGTM!

Correctly externalizes react-dom as a peer dependency to prevent bundling React DOM into the library.


22-23: Approve: package.json exports & typesVersions align with updated entry structure.

Comment on lines 24 to 27
"react-router": resolve(
__dirname,
"src/components/react-router-dom/index.ts",
"src/components/react-router-dom/index.ts"
),
Copy link

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

Consider consistency with the react-router entry naming.

The react-router entry key doesn't follow the /index suffix pattern used for components/index and utils/index. Verify whether this is intentional based on how ./react-router is exported in package.json, or if it should be renamed to "react-router/index" for consistency.


🏁 Script executed:

#!/bin/bash
# Check how react-router is exported in package.json
jq '.exports."./react-router"' package.json

Length of output: 4


🏁 Script executed:

#!/bin/bash
rg -nP 'alias:\s*{' -n vite.config.ts -C20

Length of output: 0


🏁 Script executed:

#!/bin/bash
file=$(fd vite.config.ts | head -n1 || find . -type f -name vite.config.ts | head -n1)
echo "Inspecting Vite config at: $file"
sed -n '1,200p' "$file"

Length of output: 1776


🏁 Script executed:

#!/bin/bash
jq '.exports' package.json || echo "No exports field in package.json"

Length of output: 540


Add or align the react-router subpath export to match your build entry
The library build defines a react-router entry (vite.config.ts, lib.entry → "react-router"), but package.json’s exports lacks ./react-router. Either rename the entry key to react-router/index (like your other /index entries) and map ./react-routerdist/react-router/index.* in exports, or keep it as-is and add an ./react-router export pointing to dist/react-router.*.

🤖 Prompt for AI Agents
In vite.config.ts around lines 24–27 the lib entry defines "react-router" but
package.json exports lacks a ./react-router subpath, causing a mismatch; fix by
either renaming the Vite lib entry to "react-router/index" to match your other
index-based entries and then add an exports mapping of "./react-router":
"dist/react-router/index.*" in package.json, or keep the current entry name and
add "./react-router": "dist/react-router.*" to package.json exports; ensure the
export path you add matches the actual built file names and update any other
export/entry keys to stay consistent.

@p-stam001 p-stam001 requested a review from a team as a code owner October 9, 2025 04:56
@onderay onderay requested a review from DanielRivers October 10, 2025 00: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.

Bug: (Export Issue in CRA(react-scripts) Project)

2 participants