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, 1:49:46 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

39 sources
The technology to cull code can work for dynamic languages too, even tho it does get difficult sometimes (google closure compiler[1] does dead code elimination for js, for example). It's just that most dynamic language users don't make the attempt (and you end up with this dependabot giving you thousands of false positives due to the deep dependency tree). [1]https://github.com/google/closure-compiler
In Turn Dependabot off
This can give you some hints of the current status of closure compiler: https://github.com/google/closure-compiler/issues/2731 I happen to know this because we have some old projects that depend on this and are working hard to get rid of the dependency. I wish Google either updates it or just mark the whole thing deprecated -- the world has already moved on anyway. Relating this to Google's recent cost cutting, and seeing some other Google's open source projects more or less getting abandoned, I have to say that today's Google is definitely not the same company from two decades ago.
In Node.js adds experimental support for TypeScript
Well, the nice thing with Python types is that the _only_ difference to untyped Python is the type annotations. Last time I worked with TypeScript (two and a half years ago), it felt more like a different language _similar_ to JS. In my experience it was quite... viral. With MyPy I've genuinely seen just specific parts of a code base become typed and didn't notice any friction. I wonder what would happen if that proposal for type comments in JS went through. Would TypeScript become just a type checker / optimizing compiler? Google's Closure had an (IMHO) nicer approach (using doc comments for type annotations, see: https://github.com/google/closure-compiler/wiki/Types-in-the...), but I don't get the impression it'll ever catch on outside Google.
In Figma’s Journey to TypeScript
I remember finding a similar thing while working on minifying JavaScript. If you have code like func("hello world"); func("hello world"); Then naively it seems that can be optimized to this: let s = "hello world"; func(s); func(s); However once compressed, the second result is usually larger! It's basically because the second example adds the `let s =` part which is new unique content it has to store. So if you want to minify JavaScript to a shorter version uncompressed, it's good to transform the first to the second. However if you want to minify JavaScript to the smallest compressed size, it's actually better to do the reverse transform and turn the second case in to the first! But then you get in to tradeoffs with parse time with a longer input, especially with very long strings - so I'm not sure any of today's minifiers actually do th
Read the rest
at. (Edit - turns out Closure Compiler does: https://github.com/google/closure-compiler/wiki/FAQ#closure-...)
In Minify and Gzip (2022)
10 years ago I have used Closure compiler from Google, https://github.com/google/closure-compiler/wiki/Annotating-T... , as a type checker. We had to use for production a different minimizer, not the closure compiler, but it was extremely useful to check for types and JSDoc-style annotations were very readable with minimal distraction. Flow for JS from Facebook also supports types-as-comments, https://flow.org/en/docs/types/comments/ , but those are rather ugly as one has to intermix them with JS rather than using separated comment block on top.
In TS to JSDoc Conversion

Showing the 15 most recent of 39 sources. Enable JavaScript to search and browse every indexed mention.

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.