File tree Expand file tree Collapse file tree 2 files changed +20
-12
lines changed Expand file tree Collapse file tree 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
201201 <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>
202202 <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>
203203 <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>
204205 </tr >
205206</table >
206207
Original file line number Diff line number Diff line change @@ -101,19 +101,26 @@ export default async (
101101 const presets = babelrc . presets || [ ]
102102 const plugins = babelrc . plugins || [ ]
103103
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+ ]
114121 ]
115- ]
116- } )
122+ } )
123+ }
117124
118125 const extractFromFile = async ( file : string ) => {
119126 const babelOpts = {
You can’t perform that action at this time.
0 commit comments