I am using flow in my react app and started using web workers also using flow-immutable-models flow is working in main thread executed files but doesn't work in worker file.
When webpack server restarts after save will get stuck at sail plugin.
Did anyone face kinda issue in past?
My code as follows: controller file
import ImportWorker from 'worker-loader!./ImportWorker.js';
....
const worker = new ImportWorker();
worker.onmessage = this.handleMsg;
this.worker = worker;
worker file
//@flow
const parseCSV = ({
file,
config = {}
}): Promise<{
file: File,
parsedFile: {
fileRows: Array<Object>,
fileHeaders: Array<string>
}
}> => {
return new Promise((resolve, reject) => {
// some passing logic
});
};
// some handelIncomingMsg handler logic
onmessage = e => {
try {
handelIncomingMsg(e);
} catch (err) {
onError({ ...err, id: e.data.id });
}
};
For others who are facing this issue, mine got fixed after changing the order in webpack loader config.
Old config
New config