babel-plugin-macros: False positive in macrosRegex
We recently released @formatjs/macro
and got this issue https://github.com/formatjs/react-intl/issues/1511 for a user. The macro we use is not compatible with babel-plugin-macros because we use that in TS transformer & eslint as well so we don’t wrap it, but it looks like babel-plugin-macros might be too aggressive and throw an error if it detects anything that looks like macrosRegex
. My suggestion: Can we turn this into a warning?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (9 by maintainers)
Alright, to whom it may concerns.
We had to extend our Babel config to supply a custom
isMacrosName()
function. https://github.com/kentcdodds/babel-plugin-macros/blob/2cac571a5809c42671c2bcbd74921df65036369e/src/index.js#L5-L6babel.config.js:
@kentcdodds I couldn’t find any documentation for
isMacrosName()
, neither in user docs, nor author docs. https://github.com/kentcdodds/babel-plugin-macros/search?q=isMacrosName&unscoped_q=isMacrosNameI face the same warning from
@formatjs/macro
as described here https://github.com/formatjs/react-intl/issues/1511Here is the reuslt of
npm ls
:Error Log:
This is still broken in CRA. My tests always fails because of this issue.
@kentcdodds it can be configured to work now. But zero config tools like CRA are still broken with react-intl.
I think this check could be improved.
What is the resolution to this
react-intl
issue within create-react-app when it is preferred to not modify babel? I just tested and it is still broken forreact-scripts: 3.3.0-next.80
. The mainline repository says they cannot fix: https://github.com/formatjs/react-intl/issues/1511@tdeekens reported it so I can’t really confirm 😦 it’s a transient issue to me.