Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

flatten returns null #3

Closed
timdp opened this issue Jun 18, 2016 · 2 comments
Closed

flatten returns null #3

timdp opened this issue Jun 18, 2016 · 2 comments

Comments

@timdp
Copy link

timdp commented Jun 18, 2016

On this line, I'm getting null back for flatten and then the plugin crashes. Maybe it needs a check? Or is flatten misbehaving? With a bit of logging, I could see that quite a few function calls were actually resulting in a null.

I think I may be using the plugin wrong though. I'm trying to combine it with Babel and Node module resolution and I'm unsure where to insert it in the plugin chain. I'm guessing it should just work anywhere because it inspects function calls in the AST and should therefore be compatible with any tree structure?

My actual goal is to remove statements that match either logger.*() or this._logger.*() in a production build. Can that be achieved? Especially the latter is probably going to be problematic because of the this?

Thanks!

@Rich-Harris
Copy link
Contributor

Thanks! Should be fixed in 1.1.0 (it was expecting the top-most object of any member expression to be an identifier – things like this look different as far as an AST is concerned. Have added support for this and super, which are the only relevant identifier-like keywords that immediately occur to me)

@timdp
Copy link
Author

timdp commented Jun 19, 2016

Thanks! In the meantime, I've been cooking up my own plugin tailored to what I was trying to achieve. I just open sourced it. I'll probably mess with it some more before I publish it, but I thought it might inspire you.

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

No branches or pull requests

2 participants