-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
External deps #9
Comments
Yup, that's what Alternatively, it would be pretty easy to add |
Using ES Modules is now supported in 0.1.5. It works like this: import workerize from 'workerize';
const worker = workerize(`
import fetchJson from './fetcher'
export function get(url) {
return fetchJson(url)
}
`, { type: 'module' });
worker.get('./some-url').then( data => {
console.log('Response: ', data);
}); |
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? |
You need to use a browser that supports modules-in-Workers. I believe Chrome Canary would let you try that out. |
So standard Chrome doesn't support it? |
@developit I'm trying to implement this but I'm getting an error in Chrome:
So yeah, maybe standard Chrome doesn't support this yet. But on Firefox I'm getting a different error:
Do you know what could be causing it? Thanks! |
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?
The text was updated successfully, but these errors were encountered: