Skip to content

Commit

Permalink
Move namespace check to main injector
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagoarrais committed Sep 16, 2019
1 parent 72e2ab6 commit dbb3dce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
6 changes: 5 additions & 1 deletion packages/babel-plugin-inject-polyfills/src/index.js
Expand Up @@ -201,7 +201,11 @@ export default declare((api, options: Options, dirname: string) => {
const key = resolveKey(path.get("property"), path.node.computed);
if (!key || key === "prototype") return;

const source = resolveSource(path.get("object"));
const object = path.get("object");
const binding = object.scope.getBinding(object.node.name);
if (binding && binding.path.isImportNamespaceSpecifier()) return;

const source = resolveSource(object);
return property(source.id, key, source.placement, path);
},

Expand Down
9 changes: 0 additions & 9 deletions packages/babel-polyfill-provider-corejs3/src/index.js
Expand Up @@ -119,15 +119,6 @@ export default ((
},

usagePure(meta, utils, path) {
const isNamespaced = path => {
if (!path.node) return false;
const binding = path.scope.getBinding(path.node.name);
if (!binding) return false;
return binding.path.isImportNamespaceSpecifier();
};

if (isNamespaced(path.get("object"))) return false;

if (meta.kind === "in") {
if (meta.key === "Symbol.iterator") {
path.replaceWith(
Expand Down

0 comments on commit dbb3dce

Please sign in to comment.