Questions tagged [google-closure-compiler]

Google Closure Compiler compiles a typed superset of modern JavaScript to a target version of JavaScript, applying type checking, dead code elimination, minification and other improvements.

google-closure-compiler
Filter by
Sorted by
Tagged with
4 votes
3 answers
897 views

Closure Compiler not Compiling ES6 library

I am in the process of writing a rather large JavaScript library using the Closure Compiler, but I made a smaller mock up to use as an example of this issue: src/main.js: export function main(str) { ...
1 vote
2 answers
556 views

Google closure compiler for java 8

which Google closure compiler version is for java 8? Tried v20220905 version: java.lang.UnsupportedClassVersionError: com/google/javascript/jscomp/CommandLineRunner has been compiled by a more recent ...
1 vote
2 answers
205 views

Error while running depswriter.py from google closure library

I am trying to build XTK following this link on Linux running on Oracle VirtualBox to get non-minified xtk.js. I am getting following error when I tried to generate the xtk-deps.js on running deps.py ...
0 votes
1 answer
233 views

webpack 4 to 5 migration support for closure compiler plugins

I have a javascript/typescript code using webpack 4 for bundling in this code I am using webpack-closure-compiler plugin when I tried to upgrade to webpack 5 according to the Docs I got the following ...
5 votes
3 answers
3k views

Sencha cmd, closure compiler error: how to locate the offending code

When running Sencha cmd 6.5, and I get the following error: [ERR] C2001: Closure Compiler Error (Parse error. undefined label "f") -- compression-input:1:4095 How can I locate the code at ...
199 votes
6 answers
106k views

How to indicate param is optional using inline JSDoc?

According to the JSDoc wiki for @param you can indicate a @param is optional using /** @param {String} [name] */ function getPerson(name) { } and you can indicate a param inline using ...
0 votes
2 answers
2k views

Combine javascript files and their source maps

I am struggling with the combination of multiple javascript files and their source maps. The problem is: I use Google Closure Compiler to obfuscate two javascript files A and B, with generated source ...
2 votes
3 answers
164 views

Google closure compiler reports JSC_UNDEFINED_VARIABLE errors on javascript keywords

I'm trying to minimize my js code using the resources-optimizer-maven-plugin which underneath is using the google closure-compiler. My problem is that, after the aggregation is completed, google ...
0 votes
0 answers
65 views

Extremely long error message when gulp closure compiler crashes

I'm working on a web-app, for which I use the google closure compiler with gulp. Here is my gulp-script: const gulp = require('gulp'); const closureCompiler = require('google-closure-compiler').gulp();...
0 votes
0 answers
62 views

Transpile only with closure compiler

I use Google Closure Compiler already for minifying my code. As part of this, I am transpiling to ECMASCRIPT5 (don't ask) with --language_out ECMASCRIPT5. But so that I can see the raw (transpiled) ...
0 votes
1 answer
153 views

How to write PHP code that repeats itself per array value

I'm using Closure Compiler to compress and join a few JavaScript files the syntax is something like this; $c = new PhpClosure(); $c->add("JavaScriptA.js") ->add("JavaScriptB.js&...
0 votes
1 answer
42 views

Is it possible to tell closure compiler that 2 typedef intersect?

I have a class for a model that contains a configuration, a plain object, with default values, and I want to create instances of this class by overriding only some of the configuration keys by passing ...
1 vote
0 answers
80 views

Closure compiler renames properties despite externs

I'm creating a web-app and I use the closure compiler (v.20230411.0.0) to optimize the performance. In this app I create a popup and use postMessage() for the communication between the main window and ...
0 votes
0 answers
532 views

google-closure-compiler-js multiple module compiling

I am compiling a couple of files by using google-closure-compiler-js on node.js; I had some misunderstandings about how to compile multiply files via JavaScript code by using the node module... so I ...
2 votes
1 answer
171 views

How to provide multiple dependencies in --chunk for closure compiler?

I have this requirement where i have test.js file dependent on x and y modules. So i was trying something like, The below code generates x and y successfully but breaks on producing the test module. ...
4 votes
1 answer
2k views

How to annotate an optional parameter using Google Closure Compiler?

I am very new to Google Closure Compiler (GCC). I am confused on how to make it show a parameter as optional... Here is part of my code: /** * @param {string} name The event name * @param {Date} ...
0 votes
1 answer
99 views

Closure Compiler - Protobuf vulnerability

We are using Java 8 and the max tag of closure compiler that supports Java 8 is v20220502, Now the protobuf-java version used in this tag is 3.17.0. that is mention is protobuf_proto_rules in ...
0 votes
1 answer
213 views

google-closure-compiler in node container gives libc.so.6: version GLIBC_2.32 not found

This used to work just fine in my Ubuntu machine with docker: docker run --rm -t node:18 bash -c "npm i -g google-closure-compiler && google-closure-compiler --version" Also tried ...
0 votes
1 answer
778 views

Google Closure Compiler Ant Build without concatenating the output

1) I finally managed to get something compiled through Google Closure Compiler using Ant to automate the process. The problem im facing, is that all the examples provided concatenate the output into ...
1 vote
1 answer
278 views

google closure compiler parser error with javascript class private field

Getting a parser error with Google Closure Compiler for JavaScript private class fields, even though according to MDN it is widely supported. Extending their example: class ClassWithPrivateField { #...
1 vote
0 answers
21 views

Can I update the extern for AbortController in the Google closure compiler?

I'm working on an application that uses Fetch in the browser. The compiler (v20221102) complains: .../src/main/js/src/Fetch.js:766:29: WARNING - [JSC_WRONG_ARGUMENT_COUNT] Function AbortController....
1 vote
0 answers
205 views

Does google closure compiler support ECMAScript modules? JSC_INVALID_MODULE_PATH error

Here is a simple example using ECMAScript modules, buffer.js: import { Buffer } from 'node:buffer'; // Creates a zero-filled Buffer of length 10. const buf1 = Buffer.alloc(10); Compiled it: # google-...
0 votes
1 answer
76 views

Does JS minifiers treat object names properties independently of object and their usage contexts?

Am I right saying that the following rule works for any/almost-any JS minifier: The property names of all objects of your program are treated as a single set of strings which have no relation to the ...
-2 votes
1 answer
71 views

TwoFer program Bug [closed]

I ran into a problem while writing the TwoFer program This is the program's code public static class TwoFer { public static string Speak() { return "One for you, one for me."...
0 votes
0 answers
91 views

Converting dot notation to array notation in Javascript files

A brief background, I use closure compiler in a project and and trying to exclude some properties of a object from being renamed. I used externs along with type based optimization to exclude ...
1 vote
2 answers
704 views

Is Google Closure Compiler Still Running Online?

Google’s Closure Compiler, which I’ve used for many years, seems to be down (https://closure-compiler.appspot.com/home). Googling turned up a lot of conflicting data, some of which seems to imply it’s ...
0 votes
1 answer
335 views

How to use the Google Closure Compiler to optimize Kotlin JS

Is it possible to use the Google Closure Compiler to minify Kotlin JS code further than what Webpack offers? If so, how can it be done?
3 votes
0 answers
107 views

How to remove important comments when using google closure compiler

I'm using CompilationLevel.SIMPLE_OPTIMIZATIONS raw js: /* aaaaaaaaaaa */ const arrA = [1, 2, 3];//some comments const arrB = [...arrA, 4, 5]; /*! This is important */ const objA = { foo: "...
2 votes
1 answer
1k views

How does Google Closure Compiler handle quotes (string literals)?

The question 'How does Google Closure Compiler handle quotes (string literals)?' could also be re-phrased like: Why does Closure replace/swap single quotes with double quotes? How does ...
10 votes
3 answers
4k views

Removing console.log with closure compiler

I'd like to make my JS code production ready by stripping out all console.log("blah blah") debugging statements. I'm confused by this popular SO answer (code below) on how to do this using Google's ...
47 votes
12 answers
22k views

Exclude debug JavaScript code during minification

I'm looking into different ways to minify my JavaScript code including the regular JSMin, Packer, and YUI solutions. I'm really interested in the new Google Closure Compiler, as it looks exceptionally ...
0 votes
1 answer
230 views

How do I force the native version of google-closure-compiler to be used?

I can import the closure-compiler like this: const ClosureCompiler = require('google-closure-compiler').compiler; but that uses the java version. I have a limitation on the build machines at work ...
1 vote
1 answer
295 views

Prevent Closure compiler from duplicating string

I'm using Google's Closure compiler to shrink my JS. There are several places in my code where I have a repeated string, e.g. (function($){ $('.bat').append('<p>the red car has a fantastically ...
2 votes
0 answers
377 views

javascript minify library with support to ES6 classes with private members

I'm looking for a library able to minify ES6 modules implementing clases with private members. All I have tried so far, including Google Closure Compiler, uglify-es, babel-minify, fails when they ...
6 votes
2 answers
3k views

@internal JavaScript documentation tag inside react code, is this jsdoc, closure, or something else?

I noticed that React uses the @internal tag for documentation. What program consumes this tag? Is it jsdoc or something else? Google Closure Compiler? I can't find this tag on http://usejsdoc.org/ ...
0 votes
1 answer
73 views

Closure Compiler: force 100% type coverage

When I run the closure compiler to type-check my code, it shows me the type coverage (but only when there's an error), e.g.: 1 error(s), 0 warning(s), 90.8% typed Is there a flag to enforce that all ...
1 vote
1 answer
219 views

js modules usage in a multi-page web app (Closure compiler)

I have a web app that contains several pages with some js files of shared code. - common1.js - common2.js - page1.js - page2.js - page3.js ... The shared files are loaded with page1 and, on a button ...
7 votes
3 answers
1k views

Idiomatic Conditional TypeScript compilation in Angular

I'm using Angular 9 and I have some code like this: (features.ts, autogenerated:) // AUTO-GENERTATED FILE. DO NOT EDIT! export const Features = { // Whether to reveal our Secret New Feature to the ...
5 votes
2 answers
491 views

Google Closure Compiler incorrectly removes function call

I am developing a HTML5 game, using Phaser and the Google Closure Compiler in advanced mode in order to package the game. I've ran into an issue where it seems I am unable to destroy a sprite. After ...
22 votes
2 answers
10k views

How do I split my javascript into modules using Google's Closure Compiler?

I want to use the google closure compiler on the javascript source we're using. In development mode we tend to break functionality to lots of files but for production would like to have them combined ...
2 votes
1 answer
845 views

Using Google Closure Compiler with React

I'm wondering about the option of integrating Google Closure Compiler with Create-React-App, or React in general, to minimize bundle size. Is it possible? Will it support all features of React at the ...
0 votes
1 answer
82 views

How to use BundleTransformer.Closure for removing unused js & css code?

There is Google Closure Compiler implementation available for .net BundleTransformer.Closure but no proper documentation, where can one get how to integrate Google Closure Compiler with .Net MVC app?
0 votes
1 answer
865 views

"ReferenceError: $jscomp is not defined" when changing output language spec by google-closure-compiler jar

I've downloaded the most recent version of compiler and i've tried to optimize js code with these flags: java -jar closure-compiler-v20211006.jar -W VERBOSE -O WHITESPACE_ONLY --language_out ...
6 votes
1 answer
3k views

Google closure compiler process node_modules

I'm trying the Google Closure Compiler as an alternative to webpack. Currently I'm using the following to compile all files inside my frontend folder: java -jar closure-compiler.jar --...
4 votes
2 answers
6k views

Invalid regular expression:: Range out of order in character class

I'm trying to use some protocol buffer code generated with protoc for javascript. I got some javascript files that i can import (after choosing the commonjs style) into other javascript files. I've ...
0 votes
1 answer
158 views

Error in Google Closure Compiler - When accessing to the Google Closure Compiler Service API occurred error with HTTP status code 'MethodNotAllowed'

During minification of JS code, readed from the file '/Content/Assets/BasicMapWidget/basic-map-widget.js', by Closure Remote JS minifier error has occurred. See more details: When accessing to the ...
5 votes
1 answer
228 views

Google Closure Compiler inlines a repeatedly used private property - a flaw or am I missing something?

I found a JavaScript base64 encoder/decoder some time ago on StackOverflow. It looks something like this: var Base64 = { // private property _keyStr : "...
4 votes
1 answer
357 views

Closure-compiler: adding prefix to obfuscated variables

My goal is adding prefix that will be prepended to all obfuscate variables. for example: instead of obfuscating myVar into x, it will use the prefix $pre so the result will be something like: $prex I'...
0 votes
2 answers
194 views

Remove debugger keyword during compilation in google closure

UPDATE: The JS version of closure-compiler is no longer supported or maintained. https://github.com/google/closure-compiler-npm/blob/master/packages/google-closure-compiler-js/readme.md Im trying to ...
0 votes
2 answers
467 views

How to install Java required for closure compiler?

I'm trying to build an Emscripten project but I get the following error: shared:WARNING: java does not seem to exist, required for closure compiler, which is optional (define JAVA in /Users/cuinjune/....

1
2 3 4 5
24