remove unncessary check

This commit is contained in:
Henry Zhu 2017-03-31 16:35:01 -04:00
parent 7df557a269
commit f33bea1363

View File

@ -50,16 +50,8 @@ export default function({ types: t }) {
const isPolyfillImport = { const isPolyfillImport = {
ImportDeclaration(path, state) { ImportDeclaration(path, state) {
if ( if (path.node.specifiers.length === 0 &&
path.node.specifiers.length === 0 && isPolyfillSource(path.node.source.value)) {
isPolyfillSource(path.node.source.value)
) {
this.numPolyfillImports++;
if (this.numPolyfillImports > 1) {
path.remove();
return;
}
path.replaceWithMultiple( path.replaceWithMultiple(
createImports(state.opts.polyfills, "import", state.opts.regenerator), createImports(state.opts.polyfills, "import", state.opts.regenerator),
); );
@ -77,12 +69,6 @@ to the "transform-polyfill-require" plugin
} }
path.get("body").forEach(bodyPath => { path.get("body").forEach(bodyPath => {
if (isRequire(bodyPath)) { if (isRequire(bodyPath)) {
this.numPolyfillImports++;
if (this.numPolyfillImports > 1) {
path.remove();
return;
}
bodyPath.replaceWithMultiple( bodyPath.replaceWithMultiple(
createImports( createImports(
state.opts.polyfills, state.opts.polyfills,