Skip to content
Extracts string messages from React components that use React Intl.
Branch: master
Clone or download
Pull request Compare This branch is 6 commits ahead, 39 commits behind formatjs:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
src
test
.babelrc
.eslintignore
.eslintrc
.gitignore
.npmignore
.travis.yml
LICENSE
README.md
package.json

README.md

babel-plugin-react-intl-require

Fork of yahoo/babel-plugin-react-intl which adds support for require React Intl instead of import it.

This Babel plugin only visits ES6 modules which import React Intl.

Node.js version 6 doesn't support ES6 modules. import is not available and require is the way to get installed modules into a node module file. This fork enables you to require the react-intl package:

const { defineMessages } = require('react-intl')
const { errorMessage } = defineMessages({
    errorMessage:{
        id:'errorMessageId',
        defaultMessage:'An error occured!',
        description:'general error message text'
    }
})

use in babel rc with "require" postfix

plugins: [
    ['react-intl-require', {
      messagesDir: 'messages',
    }]
],
You can’t perform that action at this time.