Skip to content

Extracts string messages from React components that use React Intl.

License

Notifications You must be signed in to change notification settings

hoschi/babel-plugin-react-intl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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',
    }]
],

About

Extracts string messages from React components that use React Intl.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%