Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserving bpack.hasExports on reset() #892

Closed
wants to merge 1 commit into from

Conversation

JedWatson
Copy link
Contributor

I went digging to figure out what was causing #887 and found that the hasExports setting for browser-pack is externally managed by browserify under various conditions, including the b.require() method.

Using watchify, you call .bundle() again on update which internally calls .reset() to recreate the pipeline, which creates a new this._bpack instance.

Because hasExports is not set in this._options, the hasExternal setting never makes it back into the new _bpack instance, meaning subsequent bundles behave differently.

I've fixed it by remembering the setting immediately before the pipeline is recreated, and immediately afterwards reapplying the previous value.

I considered adding it to the opts provided to this._createPipeline but didn't want to introduce any side effects, the implementation I went with is more consistent with the way this._bpack.hasExports is set in all the other cases, so it will now have exactly the same behaviour initially and after any pipeline reset.

@ghost
Copy link

ghost commented Sep 5, 2014

Thanks for the patch! I added a test case and shipped this with 5.11.1.

@ghost ghost closed this Sep 5, 2014
@JedWatson
Copy link
Contributor Author

That was fast! Thanks :)

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant