When writing Babel plugins, what can I assume about the same node being processed more than once? When or how can this happen? What are common protections if I don't want my annotations to appear twice? Should I always check if I've "seen" this node already?
-
-
Yeah looks legit. Same pattern is used in the "official" Babel plugins: https://github.com/babel/babel/blob/8c7d4b55c99ff34cb9d493d452472e59b5ed1e70/packages/babel-plugin-transform-react-constant-elements/src/index.js#L85-L86 … etc
End of conversation
New conversation -
-
You mean the next plugin in the pipeline will change the file thus trigger the flow again? If so, isn't that the same as a user saves a file or triggering it via command etc...? I mean the code has changed, its not processing the same node twice in the same "session". I think
-
Plugins don't "change files" (or at least shouldn't). It's about the case where one plugin replaces a subtree that was processed by another plugin, and now the other plugin re-runs on that subtree.
- 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
he/him 