Visitar URL original
variable declaration is removed unexpectedly · Issue #1351 · terser/terser · GitHub
Skip to content

variable declaration is removed unexpectedly #1351

Closed

Description

@miserylee

Bug report or Feature request?

Bug report

Version (complete output of terser -V or specific git commit)

terser 5.16.4

Complete CLI command or minify() options used

terser input

// test-1.js

(function (factory) {
    factory(exports);
})((function (exports) {
    var a = function () {
        var b = 0;
        var _this = {};
        _this.fn = function () {
            return b;
        }
        _this.fn2 = function () {
            b += 1;
        }
        return _this;
    }
    exports.a = a;
}));

Command: terser ./test-1.js --compress

terser output or error

!function(exports){var a=function(){var _this={fn:function(){return b},fn2:function(){b+=1}};return _this};exports.a=a}(exports);

Expected result
This result is produced by terser 5.16.3

!function(exports){var a=function(){var b=0,_this={fn:function(){return b},fn2:function(){b+=1}};return _this};exports.a=a}(exports);

Activity

  1. fabiosantoscode commented on Feb 23, 2023

    @fabiosantoscode
    Collaborator

    Thanks for reporting! I suspect this change. I'll have a look tomorrow

  2. reey commented on Feb 23, 2023

    @reey

    @fabiosantoscode Seems like 8dc5fc2 broke this.. Can we revert this commit? Sorry missed your comment..

  3. fabiosantoscode commented on Feb 23, 2023

    @fabiosantoscode
    Collaborator

    No problem @reey! Thanks for investigating

  4. fabiosantoscode commented on Feb 23, 2023

    @fabiosantoscode
    Collaborator

    Released in 5.16.5

  5. added a commit that references this issue on Dec 25, 2024
    fa6f164
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions