Can I pass options to GoogleClosureMinimizer at runtime?
I have a 3rd party javascript file (html2canvas.min.js) that
tapestry-webresources is failing to parse because the JS is using javascript
getters, which I think were introduced in ECMASCRIPT5.
2021-01-28 04:31:40,536 ERROR [org.apache.tapestry5.ioc.Registry] (default
task-14) Compilation failed: JSC_PARSE_ERROR. Parse error. getters are not
supported in older versions of JavaScript. If you are targeting newer versions
of JavaScript, set the appropriate language_in option. at
StreamableResource<text/javascript
classpath:META-INF/modules/html2canvas.min.js COMPRESSABLE lastModified: Thu
Jan 28 03:44:05 UTC 2021 size: 165202> line 20 : 0.
As I am targeting only modern versions of Chrome and Safari, it seems that I
could fix this by passing option —language_in=ECMASCRIPT5 to
google-closure-compiler, but how can I do this? Is there a system property I
can provide at runtime?
In case it helps, here’s the stack trace...
2021-01-28 04:31:40,536 ERROR [org.apache.tapestry5.ioc.Registry] (default
task-14) Compilation failed: JSC_PARSE_ERROR. Parse error. getters are not
supported in older versions of JavaScript. If you are targeting newer versions
of JavaScript, set the appropriate language_in option. at
StreamableResource<text/javascript
classpath:META-INF/modules/html2canvas.min.js COMPRESSABLE lastModified: Thu
Jan 28 03:44:05 UTC 2021 size: 165202> line 20 : 0.
2021-01-28 04:31:40,537 ERROR [org.apache.tapestry5.ioc.Registry] (default
task-14) Operations trace:
2021-01-28 04:31:40,537 ERROR [org.apache.tapestry5.ioc.Registry] (default
task-14) [ 1] Streaming compressed module html2canvas.min
2021-01-28 04:31:40,537 ERROR [org.apache.tapestry5.ioc.Registry] (default
task-14) [ 2] Streaming classpath:META-INF/modules/html2canvas.min.js
(compressed)
2021-01-28 04:31:40,537 ERROR [org.apache.tapestry5.ioc.Registry] (default
task-14) [ 3] Minimizing StreamableResource<text/javascript
classpath:META-INF/modules/html2canvas.min.js COMPRESSABLE lastModified: Thu
Jan 28 03:44:05 UTC 2021 size: 165202>
2021-01-28 04:31:40,544 ERROR
[org.apache.tapestry5.modules.TapestryModule.RequestExceptionHandler] (default
task-14) Processing of request failed with uncaught exception:
org.apache.tapestry5.ioc.internal.OperationException: Compilation failed:
JSC_PARS
E_ERROR. Parse error. getters are not supported in older versions of
JavaScript. If you are targeting newer versions of JavaScript, set the
appropriate language_in option. at StreamableResource<text/javascript
classpath:META-INF/modules/html2canvas.min.j
s COMPRESSABLE lastModified: Thu Jan 28 03:44:05 UTC 2021 size: 165202> line 20
: 0.: org.apache.tapestry5.ioc.internal.OperationException: Compilation failed:
JSC_PARSE_ERROR. Parse error. getters are not supported in older versions of
JavaScript. If yo
u are targeting newer versions of JavaScript, set the appropriate language_in
option. at StreamableResource<text/javascript
classpath:META-INF/modules/html2canvas.min.js COMPRESSABLE lastModified: Thu
Jan 28 03:44:05 UTC 2021 size: 165202> line 20 : 0.
…
Caused by: java.lang.RuntimeException: Compilation failed: JSC_PARSE_ERROR.
Parse error. getters are not supported in older versions of JavaScript. If you
are targeting newer versions of JavaScript, set the appropriate language_in
option. at StreamableResource<text/javascript
classpath:META-INF/modules/html2canvas.min.js COMPRESSABLE lastModified: Thu
Jan 28 03:44:05 UTC 2021 size: 165202> line 20 : 0.
at
org.apache.tapestry5.internal.webresources.GoogleClosureMinimizer.doMinimize(GoogleClosureMinimizer.java:97)
at
org.apache.tapestry5.internal.webresources.AbstractMinimizer$1.perform(AbstractMinimizer.java:72)
at
org.apache.tapestry5.internal.webresources.AbstractMinimizer$1.perform(AbstractMinimizer.java:68)
at
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.perform(OperationTrackerImpl.java:110)
... 101 more
Cheers,
Geoff