-
Notifications
You must be signed in to change notification settings - Fork 325
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
Switch to upstream builds of is-ipfs and js-ipfs-api #152
Comments
As mentioned in ipfs-shipyard/is-ipfs#8 (comment) browserified version works fine. 👍 Unfortunately, when I load both
Related bugs (Aergir is used by both
I'll probably have to maintain my own "merged" artifact until ipfs/aegir#36 is fixed. It is unfortunate, I really hoped to use upstream artifacts without any JS shenanigans.. |
Short update: It does not seem to be fixed upstream any time soon, so tried to build "merged" browser bundle with vanilla Entry point
Build command to expose libraries under
It works for
I think a safe approach would be to get familiar with webpack and port the config from AEgir, which proven to produce browser bundle that runs in WebExtension without any problems. |
Shower 🚿 thought:
Problem: as of now, WebExtension supports only one background page in its "background": {
"page": "background/init.html"
}, Solution: use iframes. As a PoC I've put every component in a separate
<!DOCTYPE html>
<meta charset="utf-8">
<iframe name="ipfsApiSandbox" src="sandbox/ipfsApi.html"></iframe>
<iframe name="isIpfsSandbox" src="sandbox/isIpfs.html"></iframe>
<script src="init.js"></script>
let ipfsApi = window.frames['ipfsApiSandbox'].IpfsApi
let isIpfs = window.frames['isIpfsSandbox'].IsIpfs Aaand it works perfectly 🚀 All I had to do was to make sure iframes finish loading before I access their |
- background: https://git.io/vPiVp - closes #152
This version removed babel-polyfil, which enabled us to remove sandbox workaround described in #152
It is not a good practice to maintain own build of browserified is-ipfs.
It makes AMO reviews harder and introduces noise to the code hosted in add-on repository.
Just like with
js-ipfs-api
(#151), the WebExtension should load official browserified artifact from IPFS mirror of NPM (it is now safe to do so due to SRI validation).The text was updated successfully, but these errors were encountered: