Make u write react-intl message descriptor more easy, reduce runtime code size.
$ npm install babel-plugin-react-intl-shorthand
This Babel plugin only visits ES6 modules which import
React Intl.
.babelrc
{
"plugins": [
["react-intl-shorthand"],
["react-intl", {
"messagesDir": "./build/messages/"
}]
]
}
.webpackrc
{
"extraBabelPlugins": [
["react-intl-shorthand", { "useHash": true }],
["react-intl", {
"messagesDir": "./build/messages/"
}]
]
}
useHash
: Use MurmurHash algorithms, reduce runtime code size.moduleSourceName
: The ES6 module source name of the React Intl package. Defaults to:"react-intl"
, but can be changed to another name/path to React Intl.