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

[Parser] support rename this in .call(this) inside arbitrary level .call for IIFE #5260

Merged
merged 1 commit into from
Jul 11, 2017

Conversation

ljqx
Copy link
Member

@ljqx ljqx commented Jul 11, 2017

What kind of change does this PR introduce?
bugfix

Did you add tests for your changes?
yes

If relevant, link to documentation update:
none

Summary
This change is a successor/supplementary/bugfix of #5076, which supports rename this's property for IIFE for one level .call. This PR makes that available for arbitrary level.

For example, #5076 makes this available:
with config

new webpack.ProvidePlugin({
  'window.jQuery': 'jquery',
})

code with one level .call

(function () {
  window.export = this.jQuery;
}).call(window);

will replace the jQuery with resolved one.

but code with two level .call

(function () {
  (function () {
    window.export = this.jQuery;
  }).call(this);
}).call(window);

jQuery would not be replaced.

This PR makes it available too.

Does this PR introduce a breaking change?
No

Other information

@ljqx ljqx changed the title [Parser] rename this in .call(this) inside arbitrary level .call for IIFE [Parser] support rename this in .call(this) inside arbitrary level .call for IIFE Jul 11, 2017
@webpack-bot
Copy link
Contributor

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

@sokra sokra merged commit 5a64498 into webpack:master Jul 11, 2017
@sokra
Copy link
Member

sokra commented Jul 11, 2017

Thanks

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

Successfully merging this pull request may close these issues.

None yet

3 participants