Jaaneek / useFilePicker

Simple react hook to open browser file selector.

Home Page:https://use-file-picker.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@parcel/core: Failed to resolve 'use-file-picker' package.

sultanularefin opened this issue · comments

Getting this error, though installed this package "https://github.com/Jaaneek/useFilePicker". The package is residing in "node_modules" directory, which I checked manually.

node version: v18.16.0
npm version: 9.5.1

Error Log begins:

Run `npm audit` for details.
sultanularefin@Sultanuls-MacBook-Air directionServiceParcel % npm run start        

> cac_fresh@1.0.0 start
> parcel src/index.html --open

Server running at http://localhost:1234
🚨 Build failed.

@parcel/core: Failed to resolve 'use-file-picker' from './src/ui/just_partner/Image_of_Partner.tsx'

  /Volumes/Mac_BackUP/test___projs/web/directionServiceParcel/src/ui/just_partner/Image_of_Partner.tsx:4:29
    3 | import React, {useState} from "react";
  > 4 | import {useFilePicker} from "use-file-picker";
  >   |                             ^^^^^^^^^^^^^^^^^
    5 | 
    6 | import {FileContent} from "use-file-picker/types";
    

Hi @sultanularefin, thanks for spotting that error. We've recently introduced subfolder exports to the package, and it looks like parcel doesn't like our new export config (we tested our new exports on Next and Vite, and it worked well).

I'll take a look at this issue and try to fix it asap. For now, I've found a temporary workaround that allows to still use our package with the latest version of parcel. Just import from 'use-file-picker/dist' instead of 'use-file-picker':

import { useFilePicker } from "use-file-picker/dist";

I'll post a comment in this thread when a fix is released.

Issue solved with "parcel": "^2.10.0",. Thanks for the hard work.

It looks like this issue has resurfaced in parcel ^2.12.0. The workaround still works, though.