You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We very often want to use libraries like lodash in compute intensive routines that would be good to run in workers. Have you thought about how to solve this problem?
Activity
developit commentedon Jan 13, 2018
Yup, that's what
workerize-loaderis for.Alternatively, it would be pretty easy to add
{ type: 'module' }to the Worker instance here, which would enable ES Module imports in modern browsers.developit commentedon Jan 19, 2018
Using ES Modules is now supported in 0.1.5.
It works like this:
arizonatribe commentedon May 24, 2018
I'm receiving an error when I attempt to implement this feature.
To troubleshoot, I rolled back to version 0.1.5 and attempted to directly mimic the example code:
And implementing it in a worker:
Yields the following error (also logging the worker to the console):
Any idea what I'm doing wrong?
developit commentedon Jun 1, 2018
You need to use a browser that supports modules-in-Workers. I believe Chrome Canary would let you try that out.
arizonatribe commentedon Jun 3, 2018
So standard Chrome doesn't support it?
jpvalenciag commentedon Jul 5, 2018
@developit I'm trying to implement this but I'm getting an error in Chrome:
TypeError: Failed to construct 'Worker': Module scripts are not supported on DedicatedWorker yet.So yeah, maybe standard Chrome doesn't support this yet. But on Firefox I'm getting a different error:
SyntaxError: import declarations may only appear at top level of a moduleDo you know what could be causing it? Thanks!