Skip to content

default negate-iife=false please #543

Closed

Description

@tomByrer

Not sure why you'd want to alter code behavior the author added in the first place?
ref: #354

Activity

  1. michaelficarra commented on Sep 11, 2014

    @michaelficarra
    Contributor

    Program completion value is almost never used. esmangle also defaults to not preserving program completion value. 👎.

    aside: Is there an option to preserve program completion value in uglifyjs?

  2. tomByrer commented on Sep 12, 2014

    @tomByrer
    Author

    Closure keeps IIFEs as-is. Most of the code I compress is not mine, & there either no tests or I don't have time to install & run them. I think many others are in the same situation.

    My use case is compressing files before I host them on jsDelivr free CDN. So I prefer to keep code close as authors published it, just smaller.

    Program completion value is almost never used.

    That may be true. So @michaelficarra if you'd like to make & test a PR everytime I find a program completion in the wild, I can ping you! But I suspect you are good at keeping yourself busy also ;)

  3. mishoo commented on Sep 12, 2014

    @mishoo
    Owner

    @michaelficarra there is, -c negate_iife=false.

    To be honest, this transformation doesn't bring much to the table. The size savings are probably negligible, we could make it off by default.

    However, @tomByrer — why don't you simply pass negate_iife=false in your build scripts?

  4. michaelficarra commented on Sep 12, 2014

    @michaelficarra
    Contributor

    @mishoo that's nowhere near sufficient for completion value preservation. Not every program is wrapped in an IIFE.

  5. tomByrer commented on Sep 12, 2014

    @tomByrer
    Author

    @mishoo I don't use build scripts for alot of my compression. I often use online UglifyJS before uploading to the CDN for those rare projects that don't provide minified version. Perhaps I could just fork it & hardcode the flag myself, but I see others don't like that surprise either.

    Not every program is wrapped in an IIFE.

    Very true! I think I have to deal with more IIFE usage than you. Since jsDelivr only hosts front-end code (1/3 are of the ~1200 projects we host are jQuery plugins), I'll see alot more IIFEs than a CoffeeScript guru like you! 😀
    A few even lead with a ; & their concern is well-founded since we do sever-side concocting.

  6. michaelficarra commented on Sep 15, 2014

    @michaelficarra
    Contributor

    But preserving completion value is not just about IIFEs. It's about not changing the completion value of the final statement in the program.

  7. mishoo commented on Sep 15, 2014

    @mishoo
    Owner

    @michaelficarra Indeed. Then nope, we don't have an option for it. Other than negating IIFE-s, the one thing that could affect final value is discarding constant side-effect-free ExpressionStatement-s. I could add an option for it if there's sufficient interest (I personally don't see the point though).

    Edit: s/constant/side-effect-free/

  8. added a commit that references this issue on Sep 28, 2014
  9. rvanvelzen commented on Feb 11, 2015

    @rvanvelzen
    Collaborator

    Closing in favor of #640.

  10. added 4 commits that reference this issue on Mar 1, 2017
    dfb2d43
    91f29e8
    f01c0c4
    07accd2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions