gaearon / react-hot-loader

Tweak React components in real time. (Deprecated: use Fast Refresh instead.)
http://gaearon.github.io/react-hot-loader/
MIT License
12.26k stars 801 forks source link

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

Open magicdawn opened 4 years ago

magicdawn commented 4 years ago

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

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 commented 4 years ago

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

theKashey commented 4 years ago

Easy to reproduce 👍, I'll handle it.