Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Commit

Permalink
Remove unused namespace declaration & expression (#164)
Browse files Browse the repository at this point in the history
* Remove unused namespace declaration & expression

Its minor and optimized away in minification, but in a react-native environment these left-over bits cause problems. 
The babelHelpers assignment somehow replaces the global one...which i think is a bug on their part, but I still think this is good to do.

* fix the expression pattern
  • Loading branch information
jsg2021 authored and danez committed Dec 18, 2017
1 parent 0ca9fe7 commit 3ea75c4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/index.js
Expand Up @@ -48,6 +48,8 @@ export default function babel ( options ) {
const pattern = new RegExp( `babelHelpers\\.(${keywordHelpers.join('|')})`, 'g' );

const helpers = buildExternalHelpers( externalHelpersWhitelist, 'var' )
.replace(/^var babelHelpers = \{\};\n/gm, '')
.replace(/\nbabelHelpers;$/gm, '')
.replace( pattern, 'var _$1' )
.replace( /^babelHelpers\./gm, 'export var ' ) +
`\n\nexport { ${keywordHelpers.map( word => `_${word} as ${word}`).join( ', ')} }`;
Expand Down

0 comments on commit 3ea75c4

Please sign in to comment.