Skip to content
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

”document“ should not appear in the Worker. #7779

Closed
7 tasks done
Aloento opened this issue Apr 18, 2022 · 5 comments · Fixed by #7837
Closed
7 tasks done

”document“ should not appear in the Worker. #7779

Aloento opened this issue Apr 18, 2022 · 5 comments · Fixed by #7837
Labels
feat: web workers p2-edge-case Bug, but has workaround or limited in scope (priority)

Comments

@Aloento
Copy link

Aloento commented Apr 18, 2022

Describe the bug

I use Comlink to work with Worker.
It's seems like:
image

And to use:

  const worker = new Worker(new URL("./Decoder", import.meta.url), { type: "module" });
  const decode = Comlink.wrap<typeof AVIFDecode>(worker);

Then, everything is fine with dev, but after building:
image

Reproduction

https://github.com/Aloento/ErrorRepo

Used Package Manager

yarn

Validations

@Aloento
Copy link
Author

Aloento commented Apr 18, 2022

Possible original code for this:
image

It seems like the optimizer remove the if statement.

@sapphi-red
Copy link
Member

For a workaround use worker.format.

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  worker: {
    format: 'es' // here
  }
})

@sapphi-red sapphi-red added p2-edge-case Bug, but has workaround or limited in scope (priority) and removed pending triage labels Apr 18, 2022
@Aloento Aloento closed this as completed Apr 18, 2022
@sapphi-red
Copy link
Member

sapphi-red commented Apr 19, 2022

Reopening as this is a bug

@rubiagatra
Copy link

can you give me the idea to replicate this @sapphi-red @Aloento

@Aloento
Copy link
Author

Aloento commented Jun 13, 2022

Err.zip

@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: web workers p2-edge-case Bug, but has workaround or limited in scope (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants