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

Avoid renaming object properties in Closure compiler #120

Merged
merged 1 commit into from
Nov 24, 2021

Conversation

OndraM
Copy link
Contributor

@OndraM OndraM commented Nov 24, 2021

In #113 we added getter for the config values.

However, it does not work properly. The reason is the minified version in dist/ has the properties renamed, so the _config object actually looks something like this:

{
  g: "en", 
  l: null, 
  u: true, 
  i: "cc_cookie",
  v: 365,
  …
}

So calls like cc.getConfig('current_lang') obviously won't work, because the property was renamed to g.

The reason is Closure compiler optimization. One option to avoid this is to have keys of the object quoted, see StackOverflow. Keys would then be preserved from the optimalization.

Another option would be to not use ADVANCED_OPTIMIZATIONS level on Closure and use just SIMPLE_OPTIMIZATIONS. However it would mean a little bit bigger output file.

@OndraM OndraM changed the title Avoid renaming object properties in clojure compiler Avoid renaming object properties in Closure compiler Nov 24, 2021
@orestbida
Copy link
Owner

This is what happens when no tests are set up!

@OndraM OndraM deleted the fix-object-keys branch November 25, 2021 11:30
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

Successfully merging this pull request may close these issues.

2 participants