diachedelic/capacitor-blob-writer

SSR and window object

JustACodeMonkey opened this issue · 2 comments

This package breaks when included in an Angular SSR app because window is not defined.

./node_modules/capacitor-blob-writer/blob_writer.js:12
const real_fetch = window.CapacitorWebFetch || window.fetch;

Adding ? after window might help, but would leave real_fetch undefined, which would break other things.

I have the blob_writer code wrapped in isPlatformBrowser (in Angular) to ensure the code will only execute in the browser, but because blob_writer is included in the ts, it compiles everything and throws an error on the server.

Any suggestions for how to fix this? Is this a fixable issue?

This should be fixed in v1.1.16, please test.

This should be fixed in v1.1.16, please test.

Yup, that's got it. Thanks so much.