RangerMauve / dat-archive-web

DatArchive implementation for browsers that uses dat-gateway
MIT License
30 stars 4 forks source link

Can't Bundle.js due to graceful-fs #8

Open DougAnderson444 opened 5 years ago

DougAnderson444 commented 5 years ago

@RangerMauve When I add require('dat-archive-web') to my build, when budo tries to bundle it up but there's an Uncaught TypeError: Cannot read property 'toString' of undefined in graceful-fs

fs.closeSync),
            /\bgraceful-fs\b/.test(fs.closeSync.toString()) || (fs.closeSync = module.exports.closeSync,

I suspect this has more to do with including fs packages meant for nodejs instead of the Web?

Dependency trail: dat-archive-web (meant for web) node-dat-archive pauls-dat-api fs-extra graceful-fs (meant for node)

bitmoji

RangerMauve commented 5 years ago

Try using the unpkg script tag instead of trying to bundle it with budo. :D

<script src="//unpkg.com/dat-archive-web/bundle.js"></script>
saimonmoore commented 5 years ago

yeah ran into the same issue...(using webpack)

saimonmoore commented 5 years ago

I wonder if I could use this: https://github.com/browserify/ify-loader

RangerMauve commented 5 years ago

@saimonmoore Do let us know if the ify-loader thing works!

I haven't been using webpack lately so sadly I don't know what people do in situations like this. 😅

saimonmoore commented 5 years ago

Yeah I'll play with it and see...

RangerMauve commented 5 years ago

I think @dpaez got dat-js working with Webpack. He might have some insight on the matter.

dpaez commented 5 years ago

Hi @saimonmoore, if you can share your webpack config that would be great. I've used dat-js with create-react-app so webpack was implicit to the setup.