HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
google
closure-compiler
JavaScript2014–2026
google / closure-compiler

closure-compiler

A JavaScript checker and optimizer.

36Distinct people
39Mentions
0Explicit recommenders
7.7KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A JavaScript checker and optimizer.

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 11:23:53 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year39 dated mentions

Observed mentions: 2014-08-24 21:32:39 UTC to 2026-09-14 06:49:24 UTC.

024682014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20142015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 8 mentions; 1 submissions, 7 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 6 mentions; 0 submissions, 6 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 5 mentions; 1 submissions, 4 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC101
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC202
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC817
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC606
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC514
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC000
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC000
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC303
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC101
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC404
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC505
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC101
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC312

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
Google Closure Compiler The Closure Compiler is a tool for making JavaScript download and run faster. It is a true compiler for JavaScript. Instead of compiling from a source language to machine code, it compiles from JavaScript to better JavaScript. It parses your JavaScript, analyzes it, removes dead code and rewrites and minimizes what's left. It also checks syntax, variable references, and types, and warns about common JavaScript pitfalls. Important Caveats Compilation modes other than ADVANCED were always an afterthought and we have deprecated those modes. We believe that other tools perform comparably for non-ADVANCED modes and are better integrated into the broader JS ecosystem. Closure Compiler is not suitable for arbitrary JavaScript. For ADVANCED mode to generate working JavaScript, the input JS code must be written with closure-compiler in mind. Closure Compiler is a "whole world" optimizer. It expects to directly see or at least receive information about every possible use of every global or exported variable and every property name. It will aggressively remove and rename variables and properties in order to make the output code as small as possible. This will result in broken output JS, if uses of global variables or properties are hidden from it. Although one can write custom externs files to tell the compiler to leave some names unchanged so they can safely be accessed by code that is not part of the compilation, this is often tedious to maintain. Closure Compiler property renaming requires you to consistently access a property with either obj[p] or obj.propName, but not both. When you access a property with square brackets (e.g. obj[p]) or using some other indirect method like let {p} = obj; this hides the literal name of the property being referenced from the compiler. It cannot know if obj.propName is referring to the same property as obj[p]. In some cases it will notice this problem and stop the compilation with an error. In other cases it will rename propName to something shorter, without noticing this problem, resulting in broken output JS code. Closure Compiler aggressively inlines global variables and flattens chains of property names on global variables (e.g. myFoo.some.sub.property -> myFoo$some$sub$property), to make reasoning about them easier for detecting unused code. It tries to either back off from doing this or halt with an error when doing it will generate broken JS output, but there are cases where it will fail to recognize the problem and simply generate broken JS without warning. This is much more likely to happen in code that was not explicitly written with Closure Compiler in mind. Closure compiler and the externs it uses by default assume that the target environment is a web browser window. WebWorkers are supported also, but the compiler will likely fail to warn you if you try to use features that aren't actually available to a WebWorker. Some externs files and features have been added to Closure Compiler to support the NodeJS environment, but they are not actively supported and never worked very well. JavaScript that does not use the goog.module() and goog.require() from base.js to declare and use modules is not well supported. The ECMAScript import and export syntax did not exist until 2015. Closure compiler and closure-library developed their own means for declaring and using modules, and this remains the only well supported way of defining modules. The compiler does implement some understanding of ECMAScript modules, but changing Google's projects to use the newer syntax has never offered a benefit that was worth the cost of the change. Google's TypeScript code uses ECMAScript modules, but they are converted to goog.module() syntax before closure-compiler sees them. So, effectively the ECMAScript modules support is unused within Google. This means we are unlikely to notice or fix bugs in the support for ECMAScript modules. Support for CommonJS modules as input was added in the past, but is not used within Google, and is likely to be entirely removed sometime in 2024. Supported uses Closure Compiler is used by Google projects to: Drastically reduce the code size of very large JavaScript applications Check the JS code for errors and for conformance to general and/or project-specific best practices. Define user-visible messages in a way that makes it possible to replace them with translated versions to create localized versions of an application. Transpile newer JS features into a form that will run on browsers that lack support for those features. Break the output application into chunks that may be individually loaded as needed. NOTE: These chunks are plain JavaScript scripts. They do not use the ECMAScript import and export syntax. To achieve these goals closure compiler places many restrictions on its input: Use goog.module() and goog.require() to declare and use modules. Support for the import and export syntax added in ES6 is not actively maintained. Use annotations in comments to declare type information and provide information the compiler needs to avoid breaking some code patterns (e.g. @nocollapse and @noinline). Either use only dot-access (e.g. object.property) or only use dynamic access (e.g. object[propertyName] or Object.keys(object)) to access the properties of a particular object type. Mixing these will hide some uses of a property from the compiler, resulting in broken output code when it renames the property. In general the compiler expects to see an entire application as a single compilation. Interfaces must be carefully and explicitly constructed in order to allow interoperation with code outside of the compilation unit. The compiler assumes it can see all uses of all variables and properties and will freely rename them or remove them if they appear unused. Use externs files to inform the compiler of any variables or properties that it must not remove or rename. There are default extern
Read the full README on GitHub

What Hacker News says

1 sources
The argument seems to be that if the added type system is not perfect, then it will be useless. For a working counterexample, see the Closure Compiler (https://github.com/google/closure-compiler), which adds a bolt-on, underspecified, occasionally-changing type system to Javascript. Similarly to GvR's proposal (https://mail.python.org/pipermail/python-ideas/2014-August/0...), the types are only ever checked at compile time: there's no attempt to use them as runtime assertions and very limited attempts to use them for compile-time improvements. So, yes, because they are imperfect and optional, you don't catch every type error, and you need to add type hints / casts that in a perfect system wouldn't be necessary. Is this kind of flawed type system worth it? Hell yes. I've maintained large programs in both Python and (closure-compiled) Javas
Read the rest
cript, and with the former I've wished I had the help of the limited type checking available in the latter.
In Revenge of the Types

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.