Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

published ganache bundle is very large #744

Closed
davidmurdoch opened this issue Jan 20, 2021 · 3 comments
Closed

published ganache bundle is very large #744

davidmurdoch opened this issue Jan 20, 2021 · 3 comments
Assignees
Milestone

Comments

@davidmurdoch
Copy link
Member

we ship separate both cli and a core in one package, but cli should just use the bundled core as is.

The browser bundle is also a bit chunky, should this be shipped as a separate package? Or could we somehow make it use core (probably not, since it needs to polyfill many things)?

@davidmurdoch davidmurdoch added this to the 3.0.0 milestone Jan 20, 2021
@honestbonsai honestbonsai self-assigned this Feb 3, 2021
@honestbonsai
Copy link

honestbonsai commented Feb 9, 2021

Notes

develop is default branch
uses npm

uses ttsc NOT tsc, does transformations for you
npm run build, triggers webpack process
will try to build it even if its not compiled, always run tsc before running build
ts-loader doesnt pick up all the rules from tsconfig
if its not already compiled, then it will try to compile, but it will do it wrong
there are no tests for the build output, can write them if u want

mostly working here
https://github.com/trufflesuite/ganache-core/tree/develop/src/packages/ganache, thats where the webpack is, pretty much the only job of this package

webpack.common is where the bulk of the logic is
webpack.node is just core itself
webpack.cli is for cli

CORE
.node is native modules
ganache.min.js 3.2MB
35MB total

CLI
is almost exactly the same, pretty much the same code, but CLI is just a thin wrapper over core
but we are including an extra 30 MB when we publish
cli should just import the node one

// Check sizes of dist folders
du -shc dist/*

to check things are working after the slimming

CLI down:
node ./src/packages/ganache/dist/cli/ganache.min.js

NODE, in root test.js

const ganache = require("./src/paackages/ganache/dist/node/ganache.min.js")
console.log(ganache) // {server: ..., provider: ...}

WEB
npm run build, will rebuild the docs
npm run docs.preview
run it in the browser, see if it works, debug trace transactions

const accounts = await provider.request({ method: "eth_accounts", params: []})
console.log(accounts)

@honestbonsai
Copy link

https://linuxize.com/post/how-get-size-of-file-directory-linux/

Size of dist directory
du -shc ./dist/*

@davidmurdoch
Copy link
Member Author

It is much smaller now. Always room for improvement. But good enough to close!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants