squircle-js icon indicating copy to clipboard operation
squircle-js copied to clipboard

Incorrect entry in the package.json

Open a-rebets opened this issue 7 months ago • 1 comments
trafficstars

When trying to use the package in Vite, the following error is encountered:

[vite] Internal server error: Failed to resolve entry for package "@squircle-js/react". The package may have incorrect main/module/exports specified in its package.json

Apparently this is because the output in the dist changed:

.
├── dist
│   ├── index.cjs
│   ├── index.d.cts
│   ├── index.d.ts
│   └── index.js
└── src
    └── index.tsx

while in the package.json this is specified:

{
  "name": "@squircle-js/react",
  "version": "1.2.17",
  "type": "module",
  "main": "dist/index.js",
  "module": "dist/index.mjs",
  "types": "dist/index.d.ts"
}

a-rebets avatar Apr 14 '25 02:04 a-rebets

For anyone who needs this here's a hot fix for Vite-based projects:

resolve: {
    alias: {
        "@squircle-js/react":
            "node_modules/@squircle-js/react/dist/index.js",
    },
}

a-rebets avatar Apr 26 '25 01:04 a-rebets

Thanks for the issue, will be fixed with #31

bring-shrubbery avatar May 11 '25 19:05 bring-shrubbery

Fixed, please update to latest version 🙏

bring-shrubbery avatar May 17 '25 07:05 bring-shrubbery

thank you! 🙌🏻

a-rebets avatar May 17 '25 10:05 a-rebets