RFC - babel-macros
See original GitHub issueCode modifiers are becoming popular in the javascript ecosystem, via babel-plugins (eg - many css-in-js libs, relay, etc). This issue is to open discussion on a generic system to include them in CRA apps, but still honouring the zero-config philosophy.
The proposal here is to have a constrained form of babel-plugins, disguised to appear like regular libraries. A short writeup on what it would look like here - https://github.com/threepointone/babel-macros/blob/master/README.md
- modifiers/‘macros’ would be isolated in files with
.macros.js
suffixes - there would no real trace of them in the final bundle stripping imports of all
*.macros.js
- considering they’re localised and used on demand, I expect them to have little effect on build performance, so can be enabled in both dev/prod
- because there’s no dependence on webpack, it should still work with other js tooling like jest, etc.
I’m looking for feedback on the same before I start writing code for it, as well as possible first implementations (maybe a simple css-in-js lib?)
If this doesn’t belong here, feel free to close the issue. Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:95
- Comments:62 (34 by maintainers)
Top Results From Across the Web
Kent C. Dodds on Twitter: "If you're curious what babel-macros ...
If you're curious what babel-macros is, check this thread out: github.com. RFC - babel-macros · Issue #2730 · facebook/create-react-app.
Read more >RFC 8967: MAC Authentication for the Babel Routing Protocol
RFC 8967. MAC Authentication for the Babel Routing Protocol. Abstract. This document describes a cryptographic authentication mechanism for the Babel ...
Read more >Zero-config code transformation with babel-plugin-macros
Babel started out as a transpiler to let you write the latest version of the ECMAScript specification but ship to environments that don't ......
Read more >@lingui/macro | Yarn - Package Manager
Babel Macros which transforms tagged template literals and JSX components to ICU MessageFormat. @lingui/macro is part of LinguiJS. See the documentation for ...
Read more >sku - npm
... like use a package that requires adding a Babel plugin, try Babel Macros. ... issue and follow the provided RFC template in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok, so, check this out:
unmaintained-react-scripts-babel-macros
diff:(this would be implemented as part of
babel-preset-react-app
if it becomes official)App.js
npm test
npm start
So that’s pretty rock solid awesome… 😄
We’re pretty close to merging a babel-macro-mode for styled-components. (https://github.com/styled-components/styled-components/pull/1256;
import styled from 'styled-components/macro'
)Would be awesome to be able to use that in
create-react-app
ootb to get nicer class names and proper minification just like that!