-
Notifications
You must be signed in to change notification settings - Fork 476
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
browserify -- provide instructions and best practices #31
Comments
I don't think this package has any specific browserify requirements. |
Could you please explain what the best practice is to use solc in Jest tests? Requiring solc in Jest tests also leads to "Uncaught TypeError: soljson.cwrap is not a function" |
I am not able to reproduce that problem. Browserify works for me locally. Are you sure you have a local |
Get the same issue with in my js test file :
fails with:
|
I'm where you are lol. Webpack, react redux app. This is my only hangup. Thinking about setting up an api to a server just to get the abi and bytecode for a contract. lol |
Yea, can't get it to work either. Does anyone have examples of it working? I just need the bytecode, nothing else on the frontend. I tried browser-solc, but you need to parse the results, and there is no documentation to how it actually outputs. |
So am I correct in thinking this + browserify/webpack is broken? |
I have the same error "Uncaught TypeError: soljson.cwrap is not a function" in my Jest test files. Without Jest it works fine. Is there anyone who have found a solution for Jest? |
Same error here. I'm in Angular (Webpack). I downloaded the soljson.js bin, and did :
Same thing with import from :
I saw the electron warning, but it doesn't seems relevant in this case. |
I've been able to fix this issue w/ Jest adding the following setup in my package.json file:
HTH @max-block |
If you want to import solc in the browser you need to :
<script type="text/javascript" src="https://ethereum.github.io/solc-bin/bin/list.js"></script>
<script type="text/javascript" src="https://ethereum.github.io/solc-bin/bin/{{ SOLC VERSION }}.js"></script> This will load 3 global variables :
import * as wrapper from 'solc/wrapper'; // OR const solc = require('solc/wrapper');
const solc = wrapper(window.Module);
const compiled = solc.compile(/* Your contract */); If someone knows why the default |
@GrandSchtroumpf could you submit a README update? |
Sure. Btw, do you know why the default |
Please provide the browserify instructions and best practices. Many people will use this module in the browser. We should have a solid known way to browserify everything properly.
i.e. something like this:
The text was updated successfully, but these errors were encountered: