web-monetization-projects icon indicating copy to clipboard operation
web-monetization-projects copied to clipboard

ilp-plugin-btp/ilp-protocol-stream require window object in MV3

Open Danisco212 opened this issue 2 years ago • 1 comments

An object of class IlpPluginBtp from package ilp-plugin-btp cannot be initialized in the service worker of a mv3 chrome extension.

Reason: Uncaught ReferenceError: window is not defined

It requires a window object which is not present in the service worker.

Temporary resolutions

unplug these packages ilp-plugin-btp and ilp-protocol-stream with yarn unplug <package_name>

in ilp-plugin-btp: replace const {crypto} = window with const{crypto} = self in file crypto.js in ilp-protocol-stream: replace const {crypto} = window with const{crypto} = self in file crypto-browser.js

TODO

We will need to patch the ILP libs upstream to officially support Service Workers

Look into exports field of package.json and see if it supports a worker "condition" export and see if can make PRs to respective repositories:

Danisco212 avatar Apr 25 '22 03:04 Danisco212

sublimator avatar May 27 '22 03:05 sublimator