File tree 2 files changed +20
-12
lines changed
2 files changed +20
-12
lines changed Original file line number Diff line number Diff line change @@ -201,6 +201,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
201
201
<td align="center"><a href="http://ddem.us/"><img src="https://avatars1.githubusercontent.com/u/290457?v=4" width="100px;" alt="Gregor MacLennan"/><br /><sub><b>Gregor MacLennan</b></sub></a><br /><a href="https://github.com/akameco/extract-react-intl-messages/commits?author=gmaclennan" title="Code">💻</a></td>
202
202
<td align="center"><a href="https://github.com/zarv1k"><img src="https://avatars1.githubusercontent.com/u/6296643?v=4" width="100px;" alt="Dmitry Zarva"/><br /><sub><b>Dmitry Zarva</b></sub></a><br /><a href="https://github.com/akameco/extract-react-intl-messages/commits?author=zarv1k" title="Code">💻</a></td>
203
203
<td align="center"><a href="https://github.com/panpanc"><img src="https://avatars2.githubusercontent.com/u/29132669?v=4" width="100px;" alt="Michael Pan"/><br /><sub><b>Michael Pan</b></sub></a><br /><a href="#example-panpanc" title="Examples">💡</a></td>
204
+ <td align="center"><a href="https://github.com/lensbart"><img src="https://avatars2.githubusercontent.com/u/20876627?s=460&v=4" width="100px;" alt="Bart Lens"/><br /><sub><b>Bart Lens</b></sub></a><br /><a href="https://github.com/akameco/extract-react-intl-messages/commits?author=lensbart" title="Code">💻</a></td>
204
205
</tr >
205
206
</table >
206
207
Original file line number Diff line number Diff line change @@ -101,19 +101,26 @@ export default async (
101
101
const presets = babelrc . presets || [ ]
102
102
const plugins = babelrc . plugins || [ ]
103
103
104
- presets . unshift ( {
105
- plugins : [
106
- [
107
- babelPluginReactIntl ,
108
- Object . entries ( pluginOptions ) . reduce ( ( acc , [ key , value ] ) => {
109
- if ( babelPluginReactIntlOptions . includes ( key ) ) {
110
- return { ...acc , [ key ] : value }
111
- }
112
- return acc
113
- } , { } )
104
+ if (
105
+ ! plugins . find ( plugin =>
106
+ ( Array . isArray ( plugin ) ? plugin [ 0 ] : plugin ) === 'react-intl'
107
+ )
108
+ ) {
109
+ // Append a the `react-intl` babel plugin only when it isn’t already included in the babel config
110
+ presets . unshift ( {
111
+ plugins : [
112
+ [
113
+ babelPluginReactIntl ,
114
+ Object . entries ( pluginOptions ) . reduce ( ( acc , [ key , value ] ) => {
115
+ if ( babelPluginReactIntlOptions . includes ( key ) ) {
116
+ return { ...acc , [ key ] : value }
117
+ }
118
+ return acc
119
+ } , { } )
120
+ ]
114
121
]
115
- ]
116
- } )
122
+ } )
123
+ }
117
124
118
125
const extractFromFile = async ( file : string ) => {
119
126
const babelOpts = {
You can’t perform that action at this time.
0 commit comments