codyhouse / codyhouse-framework

A lightweight front-end framework for building accessible, bespoke interfaces.
https://codyhouse.co/
MIT License
1.16k stars 172 forks source link

Error when using google-closure-compiler #138

Closed TeaEwan closed 1 year ago

TeaEwan commented 1 year ago

Project url: https://github.com/google/closure-compiler

Command: google-closure-compiler --compilation_level ADVANCED --warning_level DEFAULT --js index.js --js_output_file output_index.js

An error message appears:

index.js:260:19: ERROR - [JSC_DECLARATION_NOT_DIRECTLY_IN_BLOCK] Block-scoped declaration not directly within block: Util
  260| if(!Util) function Util () {};
                          ^^^^

index.js:304:19: ERROR - [JSC_DECLARATION_NOT_DIRECTLY_IN_BLOCK] Block-scoped declaration not directly within block: Util
  304| if(!Util) function Util () {};
                          ^^^^

index.js:969:19: ERROR - [JSC_DECLARATION_NOT_DIRECTLY_IN_BLOCK] Block-scoped declaration not directly within block: Util
  969| if(!Util) function Util () {}; 

......

How do you fix it?

claudia-romano commented 1 year ago

Hi there, we are removing the Util dependencies from all our components. Meanwhile, you can replace the Util functions (e.g., Util.osHasReducedMotion()) with a basic function (e.g. function osHasReducedMotion()). This will fix your issue.

TeaEwan commented 1 year ago

Thank you for your work.

TeaEwan commented 1 year ago

I have noticed that some components have removed Util dependencies, some have not been removed. Will it continue?

claudia-romano commented 1 year ago

Yes, the dependency will be removed from all components.