0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

「Uncaught ReferenceError: $RefreshReg$ is not defined」対応

Posted at

問題

webworker を使っていると、webworkerから使っているソースで以下のようなエラーが出る。

Uncaught ReferenceError: $RefreshReg$ is not defined

対処方法

問題が起きたソースの先頭にこれを記述する。他の方法もあるようだが、これが一番簡単だった。

// @ts-ignore
self.$RefreshReg$ = () => {}
// @ts-ignore
self.$RefreshSig$ = () => () => {}

参考リンク

https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/docs/TROUBLESHOOTING.md#usage-with-indirection-like-workers-and-js-templates
https://github.com/pmmmwh/react-refresh-webpack-plugin/issues/176#issuecomment-695780563

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?