Skip to content
This repository has been archived by the owner on Aug 21, 2019. It is now read-only.

Enable passing babel-plugin-react-intl options. #18

Closed
Filson14 opened this issue Jan 22, 2019 · 2 comments
Closed

Enable passing babel-plugin-react-intl options. #18

Filson14 opened this issue Jan 22, 2019 · 2 comments

Comments

@Filson14
Copy link

Do you want to request a feature or report a bug?:
Feature

What is the expected behavior?:
I have a case where I've wrapped react-intl with my own module with some custom functions and components to manage internationalization. I don't want the need to import some elements from it and some from react-intl. I prefer to use just one source. I've mentioned it in this issue.

babel-plugin-react-intl accepts few options to manipulate extracting process. With extract-react-intl context, most of them are not so helpful (especially if we assume using it with by extract-react-intl-messages), but one is. I mean moduleSourceName which lets plugin to know from where defineMessages or <FormattedMessage /> is imported. Of course, default is react-intl but in some cases one may want to use custom module.

Suggested solution:
It would be great to be able to pass custom module name to extract-react-intl which can forward it to babel-plugin-react-intl (I've tested it locally, simply by explicitly adding options to unshifted preset in the source code and it works).

Same thing would fit extract-react-intl-messages.

@akameco, I can try to manage some changes if you want (but never done that on someones github repo 😉 ).

@akameco
Copy link
Owner

akameco commented Jan 27, 2019

@Filson14 Sounds good. Could you send a PR?

@Filson14
Copy link
Author

Done in here #20
I wait for Your thoughts.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants