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

rewrite top-level this as undefined #707

Merged
merged 1 commit into from Jun 10, 2016
Merged

rewrite top-level this as undefined #707

merged 1 commit into from Jun 10, 2016

Conversation

Rich-Harris
Copy link
Contributor

We didn't catch that this wasn't already happening (pretty sure it did at one point), because Babel was doing it for us in the test (and we needed Babel, because we need to test behaviour inside arrow functions...)

@eventualbuddha
Copy link
Contributor

Looks good.

@Rich-Harris Rich-Harris merged commit 9d328e0 into master Jun 10, 2016
@Rich-Harris Rich-Harris deleted the undefined-this branch June 10, 2016 21:33
@cognitom
Copy link

To bundle the code for non-Node environments, sometimes this is needed on top-level. For someone like me, this is a simple workaround for it, kind of:

doSomething(that)

Add intro option:

const code = bundle.generate({
  intro: 'const that = this'
}).code;

Then the output:

const that = this
doSomething(that)

@Rich-Harris
Copy link
Contributor Author

For anyone else landing here -> #858

@cognitom
Copy link

Cool!

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

Successfully merging this pull request may close these issues.

None yet

3 participants