usebasejump/basejump

Package issue with vite/react causes build error

whithr opened this issue · 1 comments

Hi all, when installing @usebasejump/react in a project with vite, it looks like there's some issues with the npm package that causes the import to fail.

Error: (when importing anything with the package)

[ERROR] Failed to resolve entry for package "@usebasejump/react". The package may have incorrect main/module/exports specified in its package.json. [plugin vite:dep-scan]

Minimum Reproduction:

  1. npm create vite
  2. select react, typescript + swc
  3. npm install @usebasejump/react
  4. npm install
  5. add an import to App.tsx - import { usePersonalAccount } from "@usebasejump/react";
  6. then just use it so the the bundler grabs it, you don't need to get a Supabase client or anything set up first as an argument, it doesn't matter for this error - const personalAccount = usePersonalAccount();
  7. npm run dev, experience error.

I tried figuring this issue out with the package, but wasn't quite able to. I ended up just taking the hooks and types and placing directly in my repo and it all works great for now in the meantime. Thanks for making this project, it's a huge timesaver.

I encountered this issue too when Remix 2.7.0 switched to Vite. I put up a pull request for it, but in the mean time @whithr you could just update your package.json dependencies to:
"@usebasejump/react": "npm:hankmander-usebasejump-react@^0.0.7",
Which is what i did to quickly get past this.