Makes BundlrStorageDriver work in browser contexts without polyfills#379
Makes BundlrStorageDriver work in browser contexts without polyfills#379lorisleiva merged 3 commits intometaplex-foundation:mainfrom thirdweb-dev:main
Conversation
|
Hi there 👋 Thanks for this. I'm thinking of extracting this Bundlr driver as an external plugin soon so people don't inherit its dependencies by default anymore. I'm happy to ship this fix in the meantime but it looks like the tests aren't passing. Would you mind having a look at what's going on? |
This would be an even better way to fix the issue, in our case we don't actually use bundlr for anything (as of now) so that would solve it for us. (But prob still want to have even that external plugin work in both browser and node.)
Yep, I'm back in the office tomorrow so will take a look then and update here if/when I find what's going on. |
|
hey @lorisleiva, been trying to hunt down the test failure but I'm running into some issues:
Have you ran into issues where the amman node process runs out of memory while running tests? Edit: I'm running node 16 on m1 MBP for this fwiw. |
|
Further investigation results:
seems like the same is possibly happening in #380? Let me know if you want a pure reproduction case. (Though all it takes is take main, add a comment in the file to break cache, try to build & test -> OOM) |
|
so it seems to me like bundlr plugin is used at the very root level any change to it causes a full re-test of everything and that makes amman fall over because of some amman-internal (?) memory leak (?) |
|
Hey @jnsdls This is an issue with the Amman relay which seems to stop working when too many tests are executed consecutively. Can you run |
will try this, thanks! EDIT: when running with |
|
@lorisleiva any hints on this would be appreciated. I'm unable to run the tests with |
|
I've just had a look at your PR and the test that fails is the one that executes when you run Note that the same test passes in CommonJS. |
|
Ok I should be able to run that test individually then which should mean I don't need to figure out how to get Amman to run on my local without running OOM / shutting down on startup. Thank you, I'll look into it and get it fixed today! |
|
@lorisleiva could you run tests again on this, I believe it should work now! |
|
yay, passes now, thanks for your help with this @lorisleiva! |
|
Thank you! I'll add this to the next patch release asap. |
We've been getting reports from our users that installing
@thirdweb-dev/sdkrequires them to polyfill CRA and vite applications.I've hunted down the issue to be within
@metaplex-foundation/js->@bundlr-network/client.After some testing I found the simplest fix to be importing the
@bundlr-network/clientdependency with a dynamic import() instead of top level, which means the resulting bundle will load the correct version at runtime for web vs node contexts.Please let me know if there's anything I'm missing here, it seems to have no negative side-effects in my testing.