<p dir="auto">Hello,<br>
I am new to 6to5 and I am trying to convert some of my ES6 files into ES5. I have had some success with this but wasn't entirely sure my approach was right. This is what I am doing:</p>
<ol dir="auto">
<li>Using <code class="notranslate">grunt-6to5</code> to transpile my code</li>
<li>Using <code class="notranslate">grunt-browserify</code> to concatenate my files into a bundle</li>
</ol>
<p dir="auto">using the following <code class="notranslate">grunfile</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="module.exports = function(grunt) {
    require('load-grunt-tasks')(grunt);

    grunt.initConfig({
        '6to5': {
            dist: {
                files: [{
                    expand: true,
                    cwd: 'public/js/',
                    src: ['**/*.js'],
                    dest: 'public/dist/'
                }]
            }
        },
        browserify: {
            dist: {
                files: {
                    'public/dist/bundle.js' : 'public/dist/app.js'
                }
            }
        }
    });

    grunt.registerTask('default', ['6to5', 'browserify']);
}"><pre class="notranslate"><code class="notranslate">module.exports = function(grunt) {
    require('load-grunt-tasks')(grunt);

    grunt.initConfig({
        '6to5': {
            dist: {
                files: [{
                    expand: true,
                    cwd: 'public/js/',
                    src: ['**/*.js'],
                    dest: 'public/dist/'
                }]
            }
        },
        browserify: {
            dist: {
                files: {
                    'public/dist/bundle.js' : 'public/dist/app.js'
                }
            }
        }
    });

    grunt.registerTask('default', ['6to5', 'browserify']);
}
</code></pre></div>
<p dir="auto">My question is, is this the right approach or is there anyway I can combine both these steps into one?</p>
<p dir="auto">Also, upon transpiling a class, the output doesn't look as pretty as advertised. It adds the following block to every transpiled file (and it is understandable)</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="var _prototypeProperties = function (child, staticProps, instanceProps) {
  if (staticProps) Object.defineProperties(child, staticProps);
  if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};"><pre class="notranslate"><code class="notranslate">var _prototypeProperties = function (child, staticProps, instanceProps) {
  if (staticProps) Object.defineProperties(child, staticProps);
  if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};
</code></pre></div>
<p dir="auto">My class goes from</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class myclass {
    greet() {
        console.log('Hello world');
    }
}"><pre class="notranslate"><code class="notranslate">class myclass {
    greet() {
        console.log('Hello world');
    }
}
</code></pre></div>
<p dir="auto">to:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&quot;use strict&quot;;

var _prototypeProperties = function (child, staticProps, instanceProps) {
  if (staticProps) Object.defineProperties(child, staticProps);
  if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};

var myclass = (function () {
  function myclass() {}

  _prototypeProperties(myclass, null, {
    greet: {
      value: function greet() {
        console.log(&quot;Hello world&quot;);
      },
      writable: true,
      enumerable: true,
      configurable: true
    }
  });

  return myclass;
})();"><pre class="notranslate"><code class="notranslate">"use strict";

var _prototypeProperties = function (child, staticProps, instanceProps) {
  if (staticProps) Object.defineProperties(child, staticProps);
  if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};

var myclass = (function () {
  function myclass() {}

  _prototypeProperties(myclass, null, {
    greet: {
      value: function greet() {
        console.log("Hello world");
      },
      writable: true,
      enumerable: true,
      configurable: true
    }
  });

  return myclass;
})();
</code></pre></div>
<p dir="auto">Which is fine but upon bundling them using broswerify, every class that got transpiled has the <code class="notranslate">_prototypeProperties</code> duplicated. Is there a trick to avoid this?</p>
<h2 dir="auto">Bug Report</h2>
<p dir="auto"><strong>Current Behavior</strong></p>
<p dir="auto">Given the current code block:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="test(function() {
                var a = 1;
                // one
        }
        // two
);"><pre class="notranslate"><span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-k">function</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
                <span class="pl-k">var</span> <span class="pl-s1">a</span> <span class="pl-c1">=</span> <span class="pl-c1">1</span><span class="pl-kos">;</span>
                <span class="pl-c">// one</span>
        <span class="pl-kos">}</span>
        <span class="pl-c">// two</span>
<span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">The first line of comment is incorrectly attributed to the trailingComments of the anonymous function:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
    &quot;type&quot;: &quot;File&quot;,
    &quot;program&quot;: {
        &quot;body&quot;: [
            {
               &quot;type&quot;: &quot;ExpressionStatement&quot;,
                &quot;expression&quot;: {
                    &quot;type&quot;: &quot;CallExpression&quot;,
                    &quot;arguments&quot;: [
                        {
                            &quot;type&quot;: &quot;FunctionExpression&quot;,
                            &quot;body&quot;: {
                                &quot;type&quot;: &quot;BlockStatement&quot;,
                            },
                            &quot;trailingComments&quot;: [
                                {
                                    &quot;type&quot;: &quot;CommentLine&quot;,
                                    &quot;value&quot;: &quot; two&quot;,
                                    &quot;start&quot;: 34,
                                    &quot;end&quot;: 40,
                                    &quot;loc&quot;: {
                                        &quot;start&quot;: {
                                            &quot;line&quot;: 4,
                                            &quot;column&quot;: 2
                                        },
                                        &quot;end&quot;: {
                                            &quot;line&quot;: 4,
                                            &quot;column&quot;: 8
                                        }
                                    }
                                },
                                {
                                    &quot;type&quot;: &quot;CommentLine&quot;,
                                    &quot;value&quot;: &quot; three&quot;,
                                    &quot;start&quot;: 46,
                                    &quot;end&quot;: 54,
                                    &quot;loc&quot;: {
                                        &quot;start&quot;: {
                                            &quot;line&quot;: 6,
                                            &quot;column&quot;: 1
                                        },
                                        &quot;end&quot;: {
                                            &quot;line&quot;: 6,
                                            &quot;column&quot;: 9
                                        }
                                    }
                                }
                            ]"><pre class="notranslate"><code class="notranslate">{
    "type": "File",
    "program": {
        "body": [
            {
               "type": "ExpressionStatement",
                "expression": {
                    "type": "CallExpression",
                    "arguments": [
                        {
                            "type": "FunctionExpression",
                            "body": {
                                "type": "BlockStatement",
                            },
                            "trailingComments": [
                                {
                                    "type": "CommentLine",
                                    "value": " two",
                                    "start": 34,
                                    "end": 40,
                                    "loc": {
                                        "start": {
                                            "line": 4,
                                            "column": 2
                                        },
                                        "end": {
                                            "line": 4,
                                            "column": 8
                                        }
                                    }
                                },
                                {
                                    "type": "CommentLine",
                                    "value": " three",
                                    "start": 46,
                                    "end": 54,
                                    "loc": {
                                        "start": {
                                            "line": 6,
                                            "column": 1
                                        },
                                        "end": {
                                            "line": 6,
                                            "column": 9
                                        }
                                    }
                                }
                            ]
</code></pre></div>
<p dir="auto"><strong>Expected behavior/code</strong><br>
trailingComments for the anonymous function should only contain the second comment line.</p>