Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Babel Plugins 101

Babel Plugins 101

Writing a Babel Plugin is simpler than you may think!

Giuseppe Gurgone

February 09, 2020
Tweet

More Decks by Giuseppe Gurgone

Other Decks in Education

Transcript

  1. Pro-tip Use AST Explorer to find out the name of

    a piece of syntax! JSXAttribute ingredients JSXIdentifier {} JSXExpressionContainer [] ArrayExpression ‘pineapple’ StringLiteral
  2. Next? Replace a path and more Babel Handbook Create a

    node: Babel Types babeljs.io/docs/en/babel-types
  3. Conclusion Babel is awesome! It is more than a tool

    for transpiling new syntax! Writing Babel plugins is empowering and my favorite (programming) hobby. True Test Drive Development: expect(transpiled).toEqual(expected); AST Explorer, Handbook and Babel Types Docs! Thank: @fkling42, James Kyle and the Babel contributors!