question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for using this as a global Babel plugin

See original GitHub issue

It would be really awesome to be able to add this to the Babel configuration (if we can control it) globally as a plugin. That would allow one to use e.g. the tw prop on JSX Element without having to import "twin.macro" everywhere 👍

Not sure how hard that would be to abstract so feel free to close this if a macro is very different from a plugin.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

12reactions
ben-rogersoncommented, Feb 19, 2021

The plugin is now up on npm 🎉 Thanks for all the work on this.

Read more at babel-plugin-twin →

6reactions
ben-rogersoncommented, Dec 9, 2020

The way I understand it, babel-plugins visit the entire document while babel-plugin-macros visit specific nodes.

At the moment the tw prop part of twin already functions like a babel-plugin within the babel-macro so I’d probably need to adjust that function to allow interop with an external babel-plugin-twin.

I’ll have a better look into this and report back.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plugins - Babel.js
Using a Plugin. If the plugin is on npm, you can pass in the name of the plugin and Babel will check that...
Read more >
Usage Guide - Babel
Instead of adding all the plugins we want one by one, we can use a "preset" which is just a pre-determined set of...
Read more >
babel/preset-env
babel /preset-env` is a smart preset that allows you to use the latest JavaScript without needing to micromanage which syntax transforms (and optionally, ......
Read more >
Options - Babel.js
These options are only allowed as part of Babel's programmatic options, so they are primarily for use by tools that wrap around Babel,...
Read more >
babel/plugin-transform-runtime
A plugin that enables the re-use of Babel's injected helper code to save on ... of core-js instead Please note that corejs: 2...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found