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

Custom configuration broken in 2.7.0-rc2 #122

Closed
OndraM opened this issue Nov 25, 2021 · 4 comments · Fixed by #123
Closed

Custom configuration broken in 2.7.0-rc2 #122

OndraM opened this issue Nov 25, 2021 · 4 comments · Fixed by #123

Comments

@OndraM
Copy link
Contributor

OndraM commented Nov 25, 2021

Hi, unfortunately the fix in #120 did not work as expected.

What happes in the Closure compiler now, is the keys in the _config defaults are preserved (thanks to #120), however, name of the actual value which is used is still minified. Meaning the _config now contains

{ 
  cookie_expiration: 182,  // value from the default config value
  v: 365 // acutally used value
  // ...
}

... so in the end getConfig() returns value from the default configuration, not the actual used one.

The way of fixing this obviously requires accessing the config as an array arguments, for example:

if(typeof conf_params['cookie_expiration'] === "number")
-                _config.cookie_expiration = conf_params['cookie_expiration'];
+                _config['cookie_expiration'] = conf_params['cookie_expiration'];

and doing so on all places. This should force the Closure compiler to avoid renaming of the fields. However, I'm not sure whether this solution is preferred, there still may be edgecases and unexpected bugs. There are two other options:

  • Only use SIMPLE_OPTIMIZATIONS level in Closure compiler.
  • Do not use Closure compiler at all, and use some other minifier.

What do you think, @orestbida?

@OndraM OndraM changed the title Overwriting settings broken in 2.7.0-rc2 Custom configuration broken in 2.7.0-rc2 Nov 25, 2021
@orestbida
Copy link
Owner

orestbida commented Nov 25, 2021

Yea, at this point it's better switching to something else, perhaps uglifyjs? I'd rather have a bit bigger filesize than a broken plugin.

Just tested and Closure compiler with SIMPLE_OPTIMIZATIONS produces the same result as uglifyjs so no point in switching to uglifyjs. Will release rc3 soon.

@OndraM
Copy link
Contributor Author

OndraM commented Nov 25, 2021

Agreed, also just for the record:

Original Size 15.68KB gzipped (76.1KB uncompressed)
SIMPLE - Compiled Size 6.59KB gzipped (18.2KB uncompressed)
ADVANCED -Compiled Size 6.46KB gzipped (17.24KB uncompressed)

So the difference between SIMPLE and ADVANCED is quite minor, especially considering the gziped size.

@orestbida
Copy link
Owner

It's up, third time's a charm! Man, @tillsanders' gonna hate me for all these releases ...

@tillsanders
Copy link
Contributor

tillsanders commented Nov 26, 2021 via email

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 a pull request may close this issue.

3 participants