-
Notifications
You must be signed in to change notification settings - Fork 682
complete 1.js file is being displayed in the terminal if ganache used programatically #2289
Comments
Can you try loading the source-map-support package before ganache and let me know if that works? https://www.npmjs.com/package/source-map-support |
Dev note: We should probably reconsider our minification approach for our node bundle, as I doubt it doesn't anything to decrease bundle size since we ship the source maps anyway. We should keep it for the browser bundle since the browser won't download and parse it unless needed, whereas node's source-map-support eagerly loads and parses it immediately (or maybe we should ship the browser bundle as a separate package 🤔). |
Thank you for the solution ! It is working, can you explain a little about this package and why is this type of error occuring.
there 200kb size difference from minified version but in solc case there was none. |
We bundle our packages to reduce installation time, and at the same time we minify it all. In doing so we generate source maps, files that can map characters in the minified file to their original source. Node.js doesn't automatically read these source map files (but browsers do, in certain situations), so you have to use source-map-support to add support. The downside to using source-map-support for you is that this will slow down the initialization of your application (i'm not sure how slow ganache's source map loading can be). There is also a downside for everyone, even if they don't use source-map-support, since it increases our bundle size, which defeats the purpose of minifying in the first place! |
Thank you so much for the answer ! |
Just to add user story: I tried upgrading a bunch of dependencies including ganache and the tests stopped passing, triage using sourcemaps is one thing, but by deploying ganache as minimized blob its really hard to add log statements to figure out where/how things fail. |
In my project i was using ganache programatically and passing options as an argument to the provider. If any error occurs it should show only error but it prints complete 1.js file in the terminal in my node project.
We can handle the issue with, 1. Prettifying minified 1.js file and other is to use try catch whenever using ganache instance.
This problem is similar to solidity's solcjson.js error.
var ganache = require('ganache');
options = { miner: { blockGasLimit: "5F5E100" }, }
provider = ganache.provider(options);
Here gaslimit should be in hex but i have put this without 0x to recreate the errror.
It would be great if this problem is solved.
The text was updated successfully, but these errors were encountered: