dsherret / ts-nameof

nameof in TypeScript
MIT License
492 stars 23 forks source link

Using with a create-react-app (v2) project #36

Open rsuk opened 5 years ago

rsuk commented 5 years ago

Any pointers on how it might be possible to use ts-nameof with a react project using create-react-app. That now uses babel for the typescript compilation so I'm unsure if it provides the configuration points necessary to set this up?

dsherret commented 5 years ago

@rsuk no sorry! There just needs to be a way to inject a ts.TransformerFactory<ts.SourceFile> object (the export of this library) into create-react-app and it would work. I haven't found anything yet, but I'll look again soon.

refex commented 3 years ago

any update on this? Thanks

dsherret commented 3 years ago

@refex create-react-app is very locked down, so I'm not sure there's a way to inject the transformer into it. It might be possible with https://github.com/timarney/react-app-rewired in case anyone has time to look into it (I do not at the moment).

refex commented 3 years ago

thanks for the hint

jieny commented 3 years ago

ts-nameof.macro babel-plugin-macros import nameof from 'ts-nameof.macro';

wondering639 commented 3 years ago

ts-nameof.macro babel-plugin-macros import nameof from 'ts-nameof.macro';

can you provide more details for beginners? :-)

mmanna3 commented 3 years ago

It's explained here:

https://stackoverflow.com/a/67670187/7027224