alewin / useWorker

⚛️ useWorker() - A React Hook for Blocking-Free Background Tasks
https://useworker.js.org/
MIT License
2.96k stars 99 forks source link

Uncaught ReferenceError: f is not defined #133

Open monski opened 1 year ago

monski commented 1 year ago

Hello,

Using create-react-app when developing npm start the library works fine. But then when i build it i got this error

Uncaught ReferenceError: f is not defined

heres is the sample code

const processData = (xlsData: string[]): Promise => new Promise((resolve, reject) => {

const arrangeData: ArrangeData[] = [];

xlsData.forEach((data: RowData, forIndex: number, arr: any) => { ... if (forIndex === arr.length - 1) { resolve({ arrangeData, groups }); } }); });

const [processWorkers] = useWorkers(processData);

//on Click const process = async (): void => { const { arrangeData, groups } = await processWorkers(data); .... }`

can you help me with this?

thank you in advance

Isaac96SM commented 1 year ago

I also have this issue, any idea? I'm using webpack@4.44.2

Arima666 commented 5 months ago

Same problem

BitBrewing commented 3 months ago

Don't use Promise in worker