0.1.0 • Published 4 years ago
babel-plugin-fbt-import v0.1.0
babel-plugin-fbt-import
A babel plugin to automatically import fbt.
Installation
$ npm install babel-plugin-fbt-import --save-devConfiguration
Add "babel-plugin-fbt-import" to the plugins list. It's important that is added before babel-plugin-fbt and babel-plugin-fbt-runtime, otherwise the latter will throw an error.
{
"plugins": [
"babel-plugin-fbt-import",
"babel-plugin-fbt",
"babel-plugin-fbt-runtime"
]
}Example
Input
function App() {
return (
<div>
<h1>
<fbt desc="Greeting">Hello</fbt>
</h1>
</div>
)
}
export default AppOutput
import { fbt } from 'fbt'
function App() {
return (
<div>
<h1>
{fbt._('Hello', null, {
hk: '26EFWw',
})}
</h1>
</div>
)
}
export default AppLicense
0.1.0
4 years ago