-
Notifications
You must be signed in to change notification settings - Fork 666
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
Running fresh from a deno Worker #1767
Comments
This sounds like export function initDevTools() {
if (typeof window != 'undefined' && window.__PREACT_DEVTOOLS__) {
window.__PREACT_DEVTOOLS__.attachPreact('10.17.1', options, {
Fragment,
Component
});
}
} We have gotten some reports in the past that |
actually the source line where the error occurs looks like this https://esm.sh/stable/[email protected]/denonext/devtools.js: /* esm.sh - esbuild bundle([email protected]/devtools) denonext production */
import{options as o,Fragment as _,Component as a}from"/stable/[email protected]/denonext/preact.mjs";function r(n,t){return o.__a&&o.__a(t),n}typeof Deno <"u"&&window.__PREACT_DEVTOOLS__&&window.__PREACT_DEVTOOLS__.attachPreact("10.15.1",o,{Fragment:_,Component:a});export{r as addHookName};
//# sourceMappingURL=devtools.js.map adding I think this is the source line you are referring to https://github.com/preactjs/preact/blob/7748dcb83cedd02e37b3713634e35b97b26028fd/devtools/src/devtools.js#L3, but I do not see where deno gets referenced, it seems like there is another source for the |
It's an upstream issue in Case in point: The code you linked to is the minifed variant of the original source. In the source we have So yeah, this is an upstream issue in So in your import map add this line: {
"imports": {
"preact/devtools": "https://esm.sh/[email protected]/devtools?target=es2022"
}
} |
Closing as it's a bug in esm.sh . With recent changes preact can be pulled in from |
I am attempting to use deno.land/x/webview + fresh as a local gui stack. I cannot run both the webview and fresh in the same process because
webview.run()
is a synchronous call. Macos requires any ui code to run in the main thread, so running the webview in a worker is out of the question webview/webview_deno#149. That leaves us with running fresh inside a web worker. That fails with the problem described below:Fresh currently depends on preact dependencies which require the
window
variable to run. Attempting to runmain.ts
in a deno Worker results in this error.It seems like
window
is specifically not part of the web worker spec, so this is expected. However it seems like at a certain point fresh was able to run in a worker webview/webview_deno#146. I am curious if this was ever an intended use case for fresh, and if there is a way to support it again.The text was updated successfully, but these errors were encountered: