google / google/closure-compiler

Source Map Generation corrupts property access with setUseOriginalNamesInOutput(true)

Open
#2,176 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

If you specify any sourceMapOutputPath together with `options.setUseOriginalNamesInOutput(true)`, then any property looses its object:

```javascript
String code = "console.log(document.readyState)";

final Compiler compiler = new Compiler();
final CompilerOptions options = new CompilerOptions();

options.setUseOriginalNamesInOutput(true);

// This option breaks the code:
options.setSourceMapOutputPath("/dev/null"); // any path

final SourceFile input = SourceFile.fromCode("js-input.js", code);
compiler.compile(Arrays.asList(), Arrays.asList(input), options);
final String compiled = compiler.toSource();

System.out.println(compiled); // should be "console.log(x.u);", but is "log(u);"
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.