dat-archive-web icon indicating copy to clipboard operation
dat-archive-web copied to clipboard

Can't Bundle.js due to graceful-fs

Open DougAnderson444 opened this issue 5 years ago • 7 comments

@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

DougAnderson444 avatar Jun 11 '19 01:06 DougAnderson444

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>

RangerMauve avatar Jun 11 '19 13:06 RangerMauve

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

saimonmoore avatar Jun 28 '19 19:06 saimonmoore

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

saimonmoore avatar Jun 28 '19 19:06 saimonmoore

@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. 😅

RangerMauve avatar Jun 29 '19 15:06 RangerMauve

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

saimonmoore avatar Jun 29 '19 20:06 saimonmoore

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

RangerMauve avatar Jul 09 '19 01:07 RangerMauve

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.

dpaez avatar Jul 09 '19 01:07 dpaez