Closed onokje closed 5 years ago
This plugin can work with Gatsby.
But Gatsby don't use .babelrc, you have to register the plugin with their own api:
exports.onCreateBabelConfig = ({ actions }) => {
actions.setBabelPlugin({
name: `babel-plugin-react-intl`,
options: {
// enforceDescriptions: true, // TODO re-enable this later
messagesDir: './translations/extracted',
},
});
};
You can also look at this: https://github.com/yahoo/babel-plugin-react-intl/issues/168#issuecomment-490041032
Seems like this has been resolved.
I have a Gatsby site that i want to use this plugin with. I installed it and added the .babelrc, but nothing happens when i do a build (I mean the build works fine, but nothing is written in ./build). It has probably something to do with the fact that i am using a gatsby site.
My .babelrc file looks like this:
{ "presets": [ [ "babel-preset-gatsby" ] ], "plugins": [ ["react-intl", { "messagesDir": "./build/messages/" }] ] }
I would like to know how i can debug this.