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"
Apparently
csv-parse
andcsv-stringify
depend onBuffer
, which exists in Node but not in the browserThis can be trivially solved by adding
buffer
as a dependencyBecause 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-shakenInstead 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"