Skip to content

Can not preserve all comments with "--comments all" #1008

Closed

Description

@imaegoo

Bug report or Feature request?

Bug report

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

5.7.0

Complete CLI command or minify() options used

terser --comments all -- input.js>output.js

terser input

;// START_TAG_FOR_2;
console.log(2);
;// END_TAG_FOR_2;

;// START_TAG_FOR_3;
console.log(3);
;// END_TAG_FOR_3;

terser output or error

// START_TAG_FOR_2;
console.log(2);// START_TAG_FOR_3;
console.log(3);// END_TAG_FOR_3;

Expected result

Possibily...

// START_TAG_FOR_2;
console.log(2);// END_TAG_FOR_2;
// START_TAG_FOR_3;
console.log(3);// END_TAG_FOR_3;

Activity

  1. changed the title [-]Can not preserve comments with "--comments all"[/-] [+]Can not preserve all comments with "--comments all"[/+] on Jun 11, 2021
  2. imaegoo commented on Jun 11, 2021

    @imaegoo
    Author

    terser input

    ;/** @preserve START_TAG_FOR_2 */;
    console.log(2);
    ;/** @preserve END_TAG_FOR_2 */;
    
    ;/** @preserve START_TAG_FOR_3 */;
    console.log(3);
    ;/** @preserve END_TAG_FOR_3 */;
    npx [email protected] -- input.js>output.js
    # or
    npx [email protected] --comments all -- input.js>output.js
    

    terser output or error

    console.log(2);console.log(3);

    Expected result

    Comments keep.

  3. jridgewell commented on Sep 19, 2021

    @jridgewell
    Collaborator

    Closing as a duplicate of #575.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions