Skip to content

CommonJS module rewriting incorrectly rewrites goog.modules #1771

@supersteves

Description

@supersteves

I can't repro this in the debugger (can't guess what I need to configure to match my build), but here's what I'm seeing (names altered for brevity):

goog.module("a");
const f = v => {
  if (v instanceof Array) v.forEach(e => f(e));
  else console.log(v);
};
exports = {
  f
}
... ERROR - variable f$$module$a is undeclared ...

Debugging the compiler, the variable in scope is actually named:
module$contents$a_f

I'm experimenting with commonjs modules, if it's related.

The workaround is to use

exports = {
  f: f
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    ES6triage-doneHas been reviewed by someone on triage rotation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions