Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asset pipeline doesn't uderstand static fields #334

Open
rlconst opened this issue Apr 16, 2024 · 5 comments
Open

Asset pipeline doesn't uderstand static fields #334

rlconst opened this issue Apr 16, 2024 · 5 comments

Comments

@rlconst
Copy link

rlconst commented Apr 16, 2024

class Foo {
    static myField = "bar"
}

error reported about expected ( after myField

Mozilla

@gsartori
Copy link

We are experiencing the same issue trying to minify the chart.js library (https://www.chartjs.org) with Grails 6.2.0 / Asset Pileline 4.4.0

elements-extra.unminified.js:568:17: ERROR - [JSC_PARSE_ERROR] Parse error. '(' expected
  568|  static defaults = {};
                        ^

1 error(s), 0 warning(s)
Closure uglify JS Exception
asset.pipeline.processors.MinifyException: [JSC_PARSE_ERROR. Parse error. '(' expected at elements-extra.unminified.js line 568 : 17]
	at asset.pipeline.processors.ClosureCompilerProcessor.process(ClosureCompilerProcessor.groovy:81)
	at asset.pipeline.processors.ClosureCompilerProcessor$process$2.call(Unknown Source)
	at asset.pipeline.AssetCompiler$_compile_closure4.doCall(AssetCompiler.groovy:171)
	at jdk.internal.reflect.GeneratedMethodAccessor284.invoke(Unknown Source)
	at java.base@17/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base@17/java.lang.reflect.Method.invoke(Method.java:568)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:274)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035)
	at groovy.lang.Closure.call(Closure.java:412)
	at groovy.lang.Closure.call(Closure.java:406)
	at java.base@17/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base@17/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base@17/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base@17/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base@17/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base@17/java.lang.Thread.run(Thread.java:833)
> Task :app-test:assetCompile FAILED

@lamon
Copy link

lamon commented Jun 20, 2024

@gsartori I had the same issue with chartjs, and until the problem is fixed, I excluded the js from the minify process:

assets {

    minifyJs = true
    minifyCss = true

    minifyOptions = [
        excludes: [
            '**/chart.umd.js'
        ]
    ]

}

@gsartori
Copy link

@lamon thank you for the workaround, unfortnuately we are including the .js file in a //= require directive so the exclusion is not working.

I'd love to be able to avoid files from being processed independently whether they are used in a require or not.

@rlconst
Copy link
Author

rlconst commented Jul 12, 2024

Should fix #329

@rlconst
Copy link
Author

rlconst commented Jul 26, 2024

Still doesn't work
[JSC_LANGUAGE_FEATURE] This language feature is only supported for UNSTABLE mode or better

Relevant options are here

There there ES2021 and UNSTABLE are missing. Probably instead of cases we should just try to call FeatureSet.fromString to be robust for future changes

Also relevant discussion about STABLE_IN and STABLE_OUT dynamic levels

@rlconst rlconst closed this as completed Jul 26, 2024
@rlconst rlconst reopened this Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants