Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 27 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,38 @@
"type": "module",
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
"require": "./dist/index.cjs",
"default": "./dist/index.mjs"
},
"./components": {
"types": "./dist/src/components/index.d.ts",
"import": "./dist/components.mjs",
"require": "./dist/components.cjs"
"types": "./dist/components/index.d.ts",
"import": "./dist/components/index.mjs",
"require": "./dist/components/index.cjs",
"default": "./dist/components/index.mjs"
},
"./utils": {
"types": "./dist/src/utils/index.d.ts",
"import": "./dist/utils.mjs",
"require": "./dist/utils.cjs"
},
"./react-router": {
"types": "./dist/src/components/react-router-dom/index.d.ts",
"import": "./dist/react-router.mjs",
"require": "./dist/react-router.cjs"
"types": "./dist/utils/index.d.ts",
"import": "./dist/utils/index.mjs",
"require": "./dist/utils/index.cjs",
"default": "./dist/utils/index.mjs"
}
},
"typesVersions": {
"*": {
"components": [
"dist/components/index.d.ts"
],
"components/*": [
"dist/components/*.d.ts"
],
"utils": [
"dist/utils/index.d.ts"
],
"utils/*": [
"dist/utils/*.d.ts"
]
}
},
"scripts": {
Expand Down
7 changes: 4 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ export default defineConfig({
lib: {
entry: {
index: resolve(__dirname, "src/index.ts"),
components: resolve(__dirname, "src/components/index.ts"),
utils: resolve(__dirname, "src/utils/index.ts"),
"components/index": resolve(__dirname, "src/components/index.ts"),
"utils/index": resolve(__dirname, "src/utils/index.ts"),
"react-router": resolve(
__dirname,
"src/components/react-router-dom/index.ts",
"src/components/react-router-dom/index.ts"
),
Comment on lines 24 to 27
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.

},
formats: ["es", "cjs"],
Expand All @@ -39,6 +39,7 @@ export default defineConfig({
external: [
"react",
"react-native",
"react-dom",
"react/jsx-runtime",
"react/jsx-dev-runtime",
"react-router-dom",
Expand Down