-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Import in worker leads to HTMLElement not define #25
Comments
in the mean time, we can add this and use dynamic imports (below it) // hack to avoid overlay.ts's dom assumptions ... const { todoDB } = await import('./dexie') |
Hey I see this issue is still open, I am facing the same problem Where exactly do we have to add the given snippet? |
i added it at the top of my Worker.js file. Under the imports and above the self.onmessage: import { ... } from './WebWorkerImports/Utils'
// hack to avoid overlay.ts's dom assumptions
self.HTMLElement = function () {
return {}
}
self.customElements = {
get () {
return []
},
}
self.onmessage = async (e) => { |
here is a fix in vite, checkout the issue it refered in the commit page: |
Describe the bug
I used xc-app to create my project.And comlink is installed.But when I run the wasm code in worker, client will report an error.
hello.worker.ts
app.tsx
client error:
Uncaught ReferenceError: HTMLElement is not defined at overlay.ts:118
more:
If you clone
test-wasm/pkg
tomy-app/src/pkg
, there will be no error.hello.worker.ts
I think vitejs/vite#3381 and vitejs/vite#5396 will help you
The text was updated successfully, but these errors were encountered: