Where are language files built when using babel-plugin-react-intl with Meteor?

I am using React Intl for translations in my app. It uses the babel-plugin-react-intl package to compile the language files from ‘messages’ that are written directly in my React components. Ordinarily, if I were building with Webpack these files would appear in a directory that is specified in the .babelrc config file:

{
  "plugins": [
    ["react-intl", {
        "messagesDir": "./build/messages/"
    }]
  ]
}

How do I specify the output location using Meteor?

1 Like

Any luck with this one @tldee?

Same question. @tidee or @voidale ?

Has anyone been able to solve this? I can’t figure out how to get the plugin to extract the messages.

That should be fixed by this pull request. It’s already merged but not in a Meteor release yet. :slight_smile:

Fantastic Klaussner, thanks for the PR :slight_smile: In the meanwhile, do you know of a quick way around it, or is it totally broken ?

To avoid the path resolution problem in the current babel-compiler version, you could replace the relative messagesDir path with an absolute path:

{
  "plugins": [
    ["react-intl", {
      "messagesDir": "/absolute/path/to/project/build/messages"
    }]
  ]
}

If you don’t want to use an absolute path, you can use the devel version of babel-compiler by copying the ecmascript and the babel-compiler package from the devel branch of the Meteor repository to a packages folder in your project. Meteor will use the local versions instead of the released versions when resolving package dependencies.

Wow, it worked instantly. If only I knew! Thank you :joy:

1 Like