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

Allow to specify custom module name passed to babel-plugin-react-intl #20

Merged
merged 1 commit into from
Jan 28, 2019

Conversation

Filson14
Copy link

@Filson14 Filson14 commented Jan 28, 2019

New option enabled to define module name from where elements defining messages are being imported (instead of default reacti-intl). It is passed to babel-plugin-react-intl

Why:
In case of using custom module based on react-intl, importing defineMessages from it successfully defines messages for an app, but later extraction is not possible without feature mentioned above.

Checklist:

  • Documentation
  • Tests
  • Ready to be merged
  • Added myself to contributors table

I was wondering, if adding only moduleSourceName option from all babel-plugin options is OK or not. I think other options are not important (or even do not make sense) in case of extract-react-intl context.

What I mean is:

  • messagesDir - the tool returns object on runtime, do not generates files
  • enforceDescription - extractor omits descriptions, so I guess it would not be helpful
  • extractSourceLocation - returned object is flat JSON structure with 'key - message' properties, so additional information would be omitted as well

I wait for other opinions, so if someone consider those needed, I can update the code.

@akameco
Copy link
Owner

akameco commented Jan 28, 2019

@Filson14 I think that moduleSourceName alone is enough.

Thank you for your PR. Merge.

@akameco akameco merged commit 1a5624e into akameco:master Jan 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants