-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Cannot run inside WebWorker #60
Comments
Welcome @siefkenj! 👋
|
This comment has been minimized.
This comment has been minimized.
Thank you for the information. It would be really nice if an error with a little more information could be thrown in the case of a misloaded module :-). As per your suggestion, I tried response = `import {toMarkdown} from 'https://esm.sh/mdast-util-to-markdown@2?worker'; console.log("hi there")`;
blob = new Blob([response], {type: 'application/javascript'});
worker = new Worker(URL.createObjectURL(blob), {type: "module"}); but it still errors... |
The problem is that esm.sh does resolve the I think it’s a great idea to use the |
@siefkenj I'll repeat again context matters, please include it when asking for support. response = `import {toMarkdown} from 'https://esm.sh/mdast-util-to-markdown@2?worker'; console.log("hi there")`;
blob = new Blob([response], {type: 'application/javascript'});
worker = new Worker(URL.createObjectURL(blob), {type: "module"}); I'm not sure what to tell you. In addition consider adding @remcohaszing's suggestion above to ensure the condition is picked up. |
I'm sorry for not including enough context. I am running Firefox 118 and Chrome 116 (as stated in the original bug report) on Linux. I am running these commands in the web console on the the page The code response = `import {toMarkdown} from 'https://esm.sh/mdast-util-to-markdown@2?worker'; console.log("hi there")`;
blob = new Blob([response], {type: 'application/javascript'});
worker = new Worker(URL.createObjectURL(blob), {type: "module"}); should print response = `import React from "https://esm.sh/react@18.2.0";\n console.log("hi there")`;
blob = new Blob([response], {type: 'application/javascript'});
worker = new Worker(URL.createObjectURL(blob), {type: "module"}); Changing the import line |
This is a bug in esm.sh then, it is not applying the condition as requested
Please read the docs that were shared on To reiterate from the first response
https://github.com/esm-dev/esm.sh/issues is their issue tracker. |
Initial checklist
Affected packages and versions
2
Link to runnable example
No response
Steps to reproduce
In a browser console, run
Expected behavior
"hi there"
should be printed to the console.Actual behavior
An error
is displayed.
Affected runtime and version
Firefox 118 / Chrome 116
Affected package manager and version
No response
Affected OS and version
No response
Build and bundle tools
No response
The text was updated successfully, but these errors were encountered: