Skip to content
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

Can't load gzip SVG assets when importing scratch-storage into another project #14

Open
joshlory opened this issue Aug 4, 2017 · 0 comments
Assignees
Labels
Milestone

Comments

@joshlory
Copy link

joshlory commented Aug 4, 2017

I'm running into a problem where all the dependencies are already inlined when importing scratch-storage into a project. For got this leads to a build that has unzipResponse inlined, even though it's not supported in the browser.

I think the problem is that got is getting inlined as a "devDependency" for the Node.js target. When the built scratch-storage npm package is run in the browser, got is hitting a codepath that isn't supported for web.

Expected Behavior

Loading a SVG from a server with gzip compression enabled shouldn't throw an error.

Actual Behavior

I get an exception: Uncaught TypeError: Cannot read property 'bind' of undefined and the asset fails to load.

screen shot 2017-08-04 at 3 41 50 pm

Steps to Reproduce

Sample code:

import Storage from 'scratch-storage';

const storage = new Storage();
const assetType = storage.AssetType.ImageVector;
storage.addWebSource([assetType], asset => `/s/${asset.assetId}.${asset.dataFormat}`);
storage.load(assetType, '09dc888b0b7df19f70d81588ae73420e').then(/* ... */);

I'm seeing this fail in the browser when /s/09dc888b0b7df19f70d81588ae73420e.svg is returned with Content-Encoding: gzip.

Operating System and Browser

Mac OS 10.12.5
Chrome 60.0.3112.90

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants