openzeppelin-contract-loader icon indicating copy to clipboard operation
openzeppelin-contract-loader copied to clipboard

Support loading contracts in a browser environment

Open spalladino opened this issue 5 years ago • 2 comments

Contract loader is currently designed to have filesystem access to load the artifacts. It would be nice if the same methods for loading artifacts in local tests could also be used when building a dapp.

We may want to look into loading the artifacts via requires or similar so they play nicely with a bundler, such as webpack. And we should ensure that this API is compatible with that of the hot-loader, and discuss merging both projects if it makes sense.

spalladino avatar Dec 18 '19 20:12 spalladino

Hey! Adding 2 cents here:

I assumed when reading the documentation that the contract-loader would do this (also be usable in a dapp). So, I was confused and tried to debug why it didn't work (the snag was caught in the usage of fs and found the answer here: https://stackoverflow.com/questions/58508257/nodejswebpackdocker-project-on-wsl-throwing-errors-with-native-fs-library).

There's no indications in the docs that it wouldn't support dapp usage. Perhaps it might be meaningful to specify this as to avoid others also going down the wrong direction.

simondlr avatar May 07 '20 15:05 simondlr

Thanks for the suggestion @simondlr! I added a note on the readme and documentation site.

nventuro avatar May 07 '20 20:05 nventuro