Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pierced module bundler does not avoid shadowing names #66

Closed
bakkot opened this Issue Apr 4, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@bakkot
Copy link
Collaborator

bakkot commented Apr 4, 2019

Suppose we have

a.js:

export function thing() {
  return 42;
}

b.js:

import { thing as other } from './a.js';

window.x = function () {
  return function thing() {
    other();
  };
};

Running bandolier with default options and passing b.js as the entrypoint produces

(function(e) {
  'use strict';
  window.x = function() {
    return function thing() {
      thing();
    };
  };
  var t = { __proto__: null };
  if (e.Symbol) e.Object.defineProperty(t, e.Symbol.toStringTag, { value: 'Module' });
  t = e.Object.freeze(t);
  return t;
})(this);

That's wrong: thing should not call itself, it should call the function which returns 42.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.