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

Warn on top-level this #770

Closed
Rich-Harris opened this issue Jul 7, 2016 · 7 comments
Closed

Warn on top-level this #770

Rich-Harris opened this issue Jul 7, 2016 · 7 comments

Comments

@Rich-Harris
Copy link
Contributor

See #759 (comment)

Rich-Harris added a commit that referenced this issue Jul 9, 2016
warn on top-level `this` – fixes #770
@timdp
Copy link

timdp commented Jul 10, 2016

I like this feature but without context, it's a bit scary. Maybe it could also log module.id, node.start, node.end, etc.?

@whaaaley
Copy link

whaaaley commented Jul 11, 2016

I'm getting this warning when I'm importing certain modules from lodash-es could this be a false positive? map, sortBy, filter, clone are the ones triggering this for me in my project. Everything seems to be working fine though and there's also no mention of undefined in the output. Is this normal?

@jdalton
Copy link
Contributor

jdalton commented Jul 12, 2016

From lodash/_root:

/** Detect `this` as the global object. */
var thisGlobal = checkGlobal(typeof this == 'object' && this);

@AgronKabashi
Copy link

I'm receiving a lot of these warnings (~20-30 times) when importing Angular 2 packages. I could suppress these messages by supplying the rollup config with my own onwarncallback but would that be considered good practice?

@TrySound
Copy link
Member

@AgronKabashi There's context option.

@code-tree
Copy link

@TrySound Could you please elaborate in the case of Angular2, as I don't yet fully understand what's going on.

Is Angular2 doing something wrong here? If I set context: 'window' is the problem solved?

(ngc is generating the code that causes this warning, so I don't know what is going on under the hood)

@AgronKabashi
Copy link

@code-tree Yes, setting context: 'window' or context: 'this' will hide those messages.

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

No branches or pull requests

7 participants