-
Notifications
You must be signed in to change notification settings - Fork 42
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
Json key not generated for fields defined by defineMessages from gatsby-plugin-intl #78
Comments
Could you try with the following {
"presets": [["babel-preset-gatsby"]],
"plugins": [
[
"react-intl",
{
"moduleSourceName": "gatsby-plugin-intl"
}
],
[
"react-intl-auto",
{
"moduleSourceName": "gatsby-plugin-intl"
}
]
]
} With this, it works on my side. I think there's probably a bug somewhere that made the need for such a configuration, but I've been struggling to figure out what's going on. |
Thanks for you reply, For the record, this was my module.exports = function (api) {
api.cache(true);
return {
presets: ["@babel/preset-react", "@babel/preset-typescript", "babel-preset-gatsby"]
}
}; Unfortunately following your suggestion, adding the plugins in babel config (also I had to install |
Just to narrow down the problem a little, in my example from the first post, whether I use import { useIntl, defineMessages } from "gatsby-plugin-intl";
const intl = useIntl();
const messages = defineMessages({
description: {
id: "about.description",
defaultMessage: "this description isn't picked up",
values: {
newline: <br />,
},
},
});
...
{intl.formatMessage(messages.description)} and import { FormattedMessage, defineMessages } from "gatsby-plugin-intl";
const messages = defineMessages({
description: {
id: "about.description",
defaultMessage: "this description isn't picked up",
values: {
newline: <br />,
},
},
});
...
<FormattedMessage {...messages.description} /> yield the same result: no |
Thanks for this great plugin! I run into problems with gatsby and TS, any help or pointer would be greatly appreciated.
node
version: 12.4npm
(oryarn
) version: yarn 1.22.4Do you want to request a feature or report a bug?: bug
What is the current behavior?:
I import
defineMessages
fromgatsby-plugin-intl
, not fromreact-intl
.When running
on a page containing:
it detects and generates only the title, not the description message:
What is the expected behavior?:
I would expect:
The text was updated successfully, but these errors were encountered: