mafintosh / tar-stream

tar-stream is a streaming tar parser and generator.
MIT License
400 stars 93 forks source link

Remove `fs` dependency to simplify web bundling #151

Closed streamich closed 1 year ago

streamich commented 1 year ago

This change removes fs dependency which greatly simplifies bundling of this package for web. Should have no effect on Node.js users.

mafintosh commented 1 year ago

Constants are platform dependent. Have you tried bundling with latest? It works fine for me due to the browser field

mafintosh commented 1 year ago

Feel free to open an issue if not

streamich commented 1 year ago

Ah, I totally missed that they can be different per platform, sorry about that.

For me the browser field causes problems, I'm bundling with Webpack and overwriting the fs module with Webpack's resolve.fallback feature. When the browser.fs = false field is present it imports the fs module as empty object:

image

When I remove the browser field, it rewrites the fs module with what ever I specify as expected.

streamich commented 1 year ago

After some searching found this:

image

The empty object is what causes the problems, at least for me, it results into constants being undefined, and once retrieving some constant it throws.