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

reactHotLoader.register(comlink.wrap(worker)) cause comlink.wrap error #1417

Open
magicdawn opened this issue Feb 7, 2020 · 2 comments
Open
Assignees

Comments

@magicdawn
Copy link

Description

source

import SomeWorker from './some.worker.js' // via worker-loader
import * as comlink from 'comlink'
const someWorker = comlink.wrap(new SomeWorker())

generated js

reactHotLoader.register(someWorker, blabla)

What you are reporting:
the register body try to get some props on someWorker, produced by comlink.wrap
it's a Proxy. and errors like

image

  • register logic wants someWorker.name
  • with comlink.expose(obj), comlink call obj.name[Symbol.toPrimitives]()

Expected behavior

be smart, don't wrap everything

Actual behavior

the babel plugin is register ing all identifiers

Environment

React Hot Loader version:

does not matter.

@magicdawn
Copy link
Author

tried cold, that does not prevent reactHotLoader.register() code

@theKashey theKashey self-assigned this Feb 11, 2020
@theKashey
Copy link
Collaborator

Easy to reproduce 👍, I'll handle it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants