google / google/closure-compiler
Object.freeze/seal prevent removal
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
Closure Library's new goog.js file has the following:
```
export const module = Object.seal({
get: goog.module.get,
// TODO(johnplaisted): Delete this once people have migrated to
// declareModuleId.
declareNamespace: goog.module.declareNamespace,
});
```
In compiled output this won't get removed, even when it isn't referenced (and `RewriteGoogJsImports` should ensure it isn't referenced after it runs...).
```
var b = this;
Object.seal({get:function() {
return null;
}, b:function(c) {
var a = b.$jscomp;
if (!a || "function" != typeof a.a) {
throw Error('Module with namespace "' + c + '" has been loaded incorrectly.');
}
a.c(a.a());
}});
```
Contributor guide
Assessment
This issue has not been assessed yet.