wyze / babel-plugin-transform-react-stateless-component-name

Adds a display name to the stateless component in the React Dev Tools.
MIT License
32 stars 8 forks source link

support and add tests for babel@7 #11

Open graingert opened 6 years ago

wyze commented 6 years ago

Will it be a breaking change to support babel 7, or is there a way to maintain backwards compatibility?

graingert commented 6 years ago

It will break backwards compatibility because you need to import the '@babel/' rather than 'babel-' versions of the packages

On Tue, 17 Apr 2018, 23:13 Neil Kistner, notifications@github.com wrote:

Will it be a breaking change to support babel 7, or is there a way to maintain backwards compatibility?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wyze/babel-plugin-transform-react-stateless-component-name/issues/11#issuecomment-382172055, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZQTBDlpCfUf7-gTYZMOx-sfqP8kC0Rks5tpmjsgaJpZM4TN01k .

wyze commented 6 years ago

Okay, thank you!

fbartho commented 5 years ago

@wyze/@graingert -- Does this transform currently work with Babel@7? We're already on Babel@7, however we're just starting to use functional components much more heavily (because of hooks).

wyze commented 5 years ago

I'm not sure if it works as the code is, but I'm open to accepting a PR to get it updated if not. It might only need the dependencies updated.

corysimmons commented 5 years ago

Tried just updating deps. AVA tests pass, but rewired CRA DevTools still just show <Unknown>...</Unknown>

tbh not sure how I got down this rabbit hole. I don't even really need this plugin. 🤔

Just do this:

const Foo = () => <h1>foo</h1>

export default Foo

...and DevTools will label it correctly.

graingert commented 5 years ago

The problem is when you do export default () => <h1>foo</h1>

On Tue, 28 May 2019, 03:54 Cory Simmons, notifications@github.com wrote:

Tried just updating deps https://github.com/corysimmons/babel-plugin-transform-react-stateless-component-name/commit/890cecb2af4e9648aee0483813bf30acc022de9d. AVA tests pass, but rewired CRA DevTools still just show

...

tbh not sure how I got down this rabbit hole. I don't even really need this plugin. 🤔

Just do this:

const Foo = () =>

foo

export default Foo

...and DevTools will label it correctly.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wyze/babel-plugin-transform-react-stateless-component-name/issues/11?email_source=notifications&email_token=AADFATEGFYYR4SMW3OTBJGDPXSNFNA5CNFSM4EZXJVSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWK2LGY#issuecomment-496346523, or mute the thread https://github.com/notifications/unsubscribe-auth/AADFATFBD3UZKDC7QBIEMFDPXSNFNANCNFSM4EZXJVSA .

corysimmons commented 5 years ago

I thought that was the whole point of this plugin? So that you could do export default () => ... and wherever you import Foo from '../MyStatelessFunction it, it would display as <Foo>...</Foo> in React Devtools? :\

graingert commented 5 years ago

Yes that's the point