Replies: 1 comment
-
BGSW cannot consume redux dependency that targets web as noted in your question. To hydrate the redux state tree on the bgsw side, you will need to use something that's built for service worker runtime - basically headless redux. If you are trying to consume a dependency, that in turn consume another dependency that exposes react code to show error <- this is the issue with that dependency not targeting SW when compiled. The idea is similar to WASM - the dependency must target the runtime or if needed, be reimplemented for such runtime. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What happened?
A bug happened!
Hi, using redux in background.ts, I found the problem as shown above, because the related dependency package references window (there is no window in Service Worker)
For example, the situation is that a custom axios is introduced in the createAsyncThunk method, and the axios wrapper internally introduces antd's message component to handle some generic error alerts. Currently it works fine after I clear the message component code.
Also tell us, what did you expect to happen?
This is probably not a bug, more like an optimization。
Is there any suggestion to avoid this problem, and is it possible to consider a package build of background.ts that excludes window related code.
Version
Latest
What OS are you seeing the problem on?
No response
What browsers are you seeing the problem on?
No response
Relevant log output
(OPTIONAL) Contact Details
No response
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions