stevendesu / jsindex

1 stars 0 forks source link

Array.load() and Array.store() don't work in a browser #21

Open stevendesu opened 5 years ago

stevendesu commented 5 years ago

Apparently csv-parse and csv-stringify depend on Buffer, which exists in Node but not in the browser

This can be trivially solved by adding buffer as a dependency

Because we don't want to override the default Buffer object if it exists (e.g. if they're using Node, or if it gets added to a later version of Chrome) we want to conditionally include it. Also, if they don't need it (maybe they're using Node) then bothering to download it at all is a waste of bandwidth and disk space. But worse than wasted disk space: conditional include statements can't be tree-shaken

Instead I should probably list it as a peer dependency or something. If I can figure out how to include a message at install time, I can even make a note like "if you plan to use this in a browser, you need to install this dependency"