Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracting messages with defineMessages exported from custom module does not work. #27

Closed
Filson14 opened this issue Dec 10, 2018 · 3 comments

Comments

@Filson14
Copy link

  • version: 0.10.0
  • node version: 10.4.1
  • npm version: 6.1.0

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

What is the current behavior?:
In my project I managed JS module to handle internationalization. It is based on react-intl but extends it with some custom components, predefined configs, extra features etc.
Because of that, I wanted to avoid necessity of imports from react-intl AND my own module, so decided to export required react-intl elements via my modules' index.js file.

Everything works great, but I figured out that when I run npm script to extract messages with extract-react-intl-messages, it does not work any more. It creates files, but there are no messages. Something like on screenshots below.

image

image

If I import defineMessages directly from react-intl it works as expected.

What is the expected behavior?:
I expect it to work exactly the same with both variants. Not sure why it's not working correctly. defineMessages is not any special kind of function. In fact, it does nothing except returning passed values.

@Filson14
Copy link
Author

Filson14 commented Jan 7, 2019

@akameco , can You take a look?

@akameco
Copy link
Owner

akameco commented Jan 7, 2019

Sorry. can not cope. Since we are using babel-plugin-react-intl we need to import from react-intl. https://github.com/yahoo/babel-plugin-react-intl

@akameco akameco closed this as completed Jan 7, 2019
@Filson14
Copy link
Author

Filson14 commented Jan 8, 2019

OK, so I gotta check there. Thanks.

Edit:
I can't see babel-plugin-react-intl in dependensies. Where do You use it exactly? I found in the docs, that it can get some options (defined in babel.rc) and one of them is moduleSourceName (which defaults to "react-intl"). That enables user to set custom module/path. @akameco, maybe You could include it in this project?

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

No branches or pull requests

2 participants