Remove requireindex, for browserify support #356
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Not the most ideal fix but I couldn't find any other feasible solution unfortunately. Background in deathcap/wsmc#19 (comment) but long story short, this change allows using
require('mineflayer')
in a browserified environment.Previously I was using
require('mineflayer/lib/block')
etc. and not accessing the mineflayer index.js at all, but this changed in ca365c3 so I tried to userequire('mineflayer').Block
instead but then it runs the unbrowserifiable requireindex module. With this PR, index.js can be browserified.Another option is to include a separate browser.js listing the modules and keep requireindex in the main index.js, but this means it has to be maintained separately. I think making the change to index.js is the simplest solution, although it does mean that this file will have to be updated when new plugins are added. Open to other suggestions but this is the best I could come up with so far (see deathcap/wsmc#19 (comment))