Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Cannot be externally browserified #86

Closed
kumavis opened this issue Feb 27, 2015 · 1 comment
Closed

Cannot be externally browserified #86

kumavis opened this issue Feb 27, 2015 · 1 comment

Comments

@kumavis
Copy link
Contributor

kumavis commented Feb 27, 2015

EDIT:

There are transforms necessary as part of the build process. This is not a problem, but external browserify processes are not aware of them. Here is a simple fix.

original description below:

The way the tree trimming is being done with envify is preventing the module from being included and browserified externally. This means even modular projects using browserify must expose ethereum.js as a global.

here is xhr as an example of one of the environment specific code that is causing problems. And here is Bignum, both are problems for subtle reasons. E.g. in the case of BigNum even if you don't enter that if statement, the var BigNum now blocks the globally exposed BigNum.

There are a couple solutions:

Add the necessary transforms to the package.json, so that browserify knows to use those when processing your module.

"browserify": {
  "transform": [ 'envify', 'unreachable-branch-transform' ]
}

Although specifying options is a little tricky
https://github.com/substack/module-deps#transforms

Another way is to rethink why those things are there in the first place. Its a weird mismatch of expectations, where you expect globals to be present in one environment and not another. Why not always expect BigNum to be present? or never expect it to be present and provide your own.

This problem can be resolved without any breaking changes, it just requires a little communication so we can figure out a solution we're both comfortable with.

So to proceed, can you explain the rational for expecting globals like BigNum?

@kumavis
Copy link
Contributor Author

kumavis commented Mar 4, 2015

This actually doesnt work on a fresh install because of where the dependencies are listed.

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

No branches or pull requests

2 participants