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

Optimize Elm code with uglify-js 3 #2127

Closed
David-Klemenc opened this issue Jul 25, 2020 · 1 comment
Closed

Optimize Elm code with uglify-js 3 #2127

David-Klemenc opened this issue Jul 25, 2020 · 1 comment

Comments

@David-Klemenc
Copy link

David-Klemenc commented Jul 25, 2020

Quick Summary: Instructions for optimization script should be updated for the new backwards incompatible version of uglify-js

SSCCE

#!/bin/sh

set -e

js="app.js"
min="app.min.js"

elm make --optimize --output=$js $@

# piping no longer needed !?
uglifyjs $js --compress "pure_funcs=[F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9],pure_getters,keep_fargs=false,unsafe_comps,unsafe" --mangle --output $min

echo "Initial size: $(cat $js | wc -c) bytes  ($js)"
echo "Minified size:$(cat $min | wc -c) bytes  ($min)"
echo "Gzipped size: $(cat $min | gzip -c | wc -c) bytes"
  • Elm: 0.19.1

Additional Details

With the new version of uglify-js (tested with uglify-js 3.10.0) piping is no longer needed (I tested with a 20 kloc elm program - and it works as expected)

Pages that should be updated:

EDIT

Switched to terser

# ...
terser $js --compress "pure_funcs=[F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9],pure_getters,keep_fargs=false,unsafe_comps,unsafe" --mangle --output=$min
# ...

as per PR#2076

@github-actions
Copy link

Thanks for reporting this! To set expectations:

  • Issues are reviewed in batches, so it can take some time to get a response.
  • Ask questions a community forum. You will get an answer quicker that way!
  • If you experience something similar, open a new issue. We like duplicates.

Finally, please be patient with the core team. They are trying their best with limited resources.

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

1 participant