Skip to content
This repository was archived by the owner on May 11, 2018. It is now read-only.

Make uglify a target #134

Closed
hzoo opened this issue Jan 10, 2017 · 6 comments
Closed

Make uglify a target #134

hzoo opened this issue Jan 10, 2017 · 6 comments

Comments

@hzoo
Copy link
Member

hzoo commented Jan 10, 2017

Going to work on this now

If you use minification already (uglify) then targeting later browers and compiling less would be useful because it will syntax error. I thought at the very least we could have an option to only check polyfills with a targetBuiltInsOnly option but making uglify its own target makes way more sense.

Of course I will be integrating/try https://github.com/babel/babili so that option wouldn't be needed

@skhameneh-sabre
Copy link

skhameneh-sabre commented Jan 13, 2017

Using Babili, I can't get my node targeted build to even come close to what Uglify produces, some of this has to do with the order of execution in Webpack. Running Babili after the project is built causes a heap exception (known issue with very large projects). I've looked at doing AST transforms myself, but the complexity of operations is introducing concerns (properly hoisting variables requires checking if the declaration is a type of Literal and conditionally replacing/removing/adding assignments).

Using Acorn with Uglify doesn't make any difference and I can't get the Harmony branch of Uglify to work (too many bugs). Targeting Uglify would be an intermediate patch, but what's really desired is a proper ES6 compatible Uglify.

Still +1 on this request, let me know if you have any other suggestions - maybe some of what I've said is useful for you as well.

@hzoo
Copy link
Member Author

hzoo commented Jan 13, 2017

also my intent is to do this for uglify 2 (not harmony) and then working on making Babili better

@skhameneh-sabre
Copy link

Understood, I'm stating this feature is only useful because Uglify doesn't fully support ES6 and Babili has less transforms than Uglify.

On a side note, I started writing code for hoisting variables (w/ Babel AST). I left off at handling logic for literals/assignment; I can share that if you'd like to take a look at it, I'm sure there are better methods to manipulate the AST than I was using.

@OlegLustenko
Copy link

Hi, any news?

@yavorsky
Copy link
Member

yavorsky commented Mar 2, 2017

@OlegLustenko Hi! I've decided to solve it after your comment and it works ok, but I need to write some tests and to make up my mind what to do with uglify/harmony. Going to send PR in the morning with a fresh mind. Seems like we have the same timezone ;)

@OlegLustenko
Copy link

Thanks :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants