Zos-lib can't be used in the browser?

Apologies if this is a silly question, I don’t have much experience with webpack.

We have a js lib for interacting with our smart contracts. It references zos-lib in order to support deploying upgradable smart contracts. It works fine when used from node.js

However, it also needs to be used from within a browser, for that we use webpack. The webpack command fails when trying to pack zos-lib. Partly because zos-lib references truffle-flattener which is a CLI not a library and webpack doesn’t seem to be able to pack CLIs (makes sense)

Is it really true that any package that references zos-lib cannot be used in a browser, or am I missing something?

Thanks for any help!

Hello @felixwatts!! Great question :slight_smile:

Unfortunately I’m not the most educated on this myself so maybe @jcarpanelli can help!

The team is on a retreat right now, so please forgive them if they don’t respond for a few days :smiley:

It seems this is currently a limitation, I’ve tried the same in my little toy dapp (https://create-token-dapp.online/) and faced the same issue.

It would be nice to be able to run zos-lib within the browser, be able to create proxies online is a very powerful feature.

1 Like

Hello, @felixwatts! Thanks for raising this. Indeed, It’s not possible to use zos-lib within the browser. I’ve just created an issue in the github repo. We’ll keep you posted if we come up with a solution :slight_smile:

2 Likes