The talk will cover all the possibilities Babel Macro opens up and also gives an overview of Abstract Syntax Tree.
This talk has been presented at React Advanced 2021, check out the latest edition of this React Conference.



Crashes, slowdowns, regressions in prod. Seer by Sentry unifies traces, replays, errors, profiles to find root causes fast.
The talk will cover all the possibilities Babel Macro opens up and also gives an overview of Abstract Syntax Tree.
This talk has been presented at React Advanced 2021, check out the latest edition of this React Conference.
The purpose of Trubesh's talk is to give an introduction to Babel macros so that attendees can write their own plugins or build their own macros.
Babel macros were introduced around 2017-2018.
An Abstract Syntax Tree (AST) is a tree representation of the source code of a computer program that conveys the structure of the source code. It is used by transpilers to understand and transform code.
Developers should learn about AST because it is a fundamental part of how transpilers work. Understanding AST helps developers comprehend how their code is being transpiled.
One can use AST Explorer to explore and understand the structure of AST. It provides a visual representation of the AST and allows users to write and transform code.
Babel started out as a transpiler that allows developers to write the latest versions of ECMAScript, even in environments where those features are not yet supported. It has evolved to become more than just a transpiler.
Babel macros are a way to apply code transformations without needing to install multiple plugins for each transformation. They are supported in frameworks like CRA, Gatsby, and Next.js.
Babel macros are easier to set up and configure, especially in tools like CRA or Gatsby. They reduce the risk of conflicts and debugging issues that can arise from the order of plugin installation.
One example of a Babel macro is the i18n translation macro, which transforms strings into their corresponding translations. Another example is the CSS to React Native macro, which converts normal CSS into React Native style sheets.
When writing Babel macros, one must ensure that they run synchronously in the node environment and are evaluated at compile time.
In this talk, I will introduce Babel macros and explain how they can be used to write plugins and build macros.
A very good morning, a very good afternoon, and a good evening, based on where you're joining. My name is Trubesh and today I'm going to give a talk on magic with Babel macros. So before we dig in into the topic, I want to also talk about why this topic, right? So I think Babel macros was introduced back in 2017, 2018. And it seemed to be a really fascinating thing because of the things you can do just by that, right? A lot of patterns emerged because of that and, yeah, but nowadays not a lot of folks talk about it. So I thought, you know, why not give it a shot and see if you folks are interested. So the aim of this talk is to give you an introduction about Babel macros so that you can go ahead and write your own plugin perhaps or build your own macros.
In this part, Srivesh introduces himself and his background in software development. He also mentions his YouTube channel and podcast. Srivesh then moves on to discuss the importance of AST in transpilers and the need for developers to understand it. He shares his experience of researching the term and provides a simplified definition of AST as a tree representation of source code that conveys its structure.
So my name is Srivesh. I'm from India. I work at a startup called Organize. I majorly handle the frontend side of things. We are also actively hiring. If anyone is looking out, please reach out to I also run a YouTube channel called the Junior Developer. And I host a podcast in that called the Junior Developer Podcast. If you are interested in frontend technologies or tech in general or maybe if you're interested in how to have an impactful development career, you should perhaps check out the channel and you might find some of the videos quite interesting. Also on Twitter, you can find me as dee underscore Junior underscore dev.
So, that's essentially my introduction. Let's get to the talk. So, AST, right? AST is an amazing thing. It stands for abstract syntax T. It's an amazing thing. And I feel that every developer should essentially learn about it. Because it's a it's essentially one of the building blocks of the transpilers which use your plugins to transpile your code, right? And without knowing it, you might not be able to understand how your code is being transpiled.
So, when I heard about this term AST, right, I got really curious and I, of course, boosted up my laptop and tried Googling what is an AST. And the first thing was of Wikipedia. And this was the definition which was thrown at me. It says in computer science, an abstract syntax tree or just syntax tree, is a representation of the abstract syntactic structure of text written in a formal language. So, this did not really this was a pretty complex definition for me. And it did not really hit me what exactly AST is. So, I tried to find a better definition which is much simpler in understanding. And I stumbled upon this definition. It says an abstract syntax tree or AST is a tree representation of the source code of a computer program that conveys the structure of source code. So, what it means by that is essentially you can look at the AST and you can derive what code you're writing. But as I mean it's of course not as readable as the human code which we write. But it's the representation is purely for machine to understand how exactly the code is structured.
We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career
Comments