Short consistent hash values for react-intl id's
npm install babel-plugin-react-intl-id-hash> react-intl id values as short consistent hash values, reduce translation file size!
This babel-plugin uses the murmur3 hash to generate short consistent message id values.
``json
`
`js
import { defineMessages } from 'react-intl'
export default defineMessages({
hello: {
id: 'App.Components.Greeting.hello',
defaultMessage: 'hello {name}'
}
})
`
With babel-plugin-react-intl-id-hash.
`js
import { defineMessages } from 'react-intl'
export default defineMessages({
hello: {
id: 'GSplhw==',
defaultMessage: 'hello {name}'
}
})
`
npm
``
$ npm install --save-dev babel-plugin-react-intl-id-hash
yarn
``
$ yarn add --dev babel-plugin-react-intl-id-hash
.babelrc
`json`
{
"plugins": [
"react-intl-id-hash"
]
}
This can be used with the babel-plugin-react-intl.
Another good alternative is babel-plugin-react-intl-auto, which must run before this plugin.
.bablerc
`json`
{
"plugins": [
["react-intl-auto", {
"removePrefix": true,
"includeExportName": true
}],
"react-intl-id-hash"
]
}
#### idHash
The name of the hash to be used for generating id values
Type: string murmur3
Default:
> currently, only murmur3` is supported
MIT