<p dir="auto">The module source looks like:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import parseIRI from './iri';
import typeProcessors from './typeProcessors';
import * as qs from './qs';
import {
          clone,
          defaults,
          parseResponseHeaders,
          createResult,
          startsWith,
          callHandlers
        }
        from './helpers';
export default Pajax;
export * from './iri';
export * from './qs';"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">parseIRI</span> <span class="pl-k">from</span> <span class="pl-s">'./iri'</span><span class="pl-kos">;</span>
<span class="pl-k">import</span> <span class="pl-s1">typeProcessors</span> <span class="pl-k">from</span> <span class="pl-s">'./typeProcessors'</span><span class="pl-kos">;</span>
<span class="pl-k">import</span> <span class="pl-c1">*</span> <span class="pl-k">as</span> <span class="pl-s1">qs</span> <span class="pl-k">from</span> <span class="pl-s">'./qs'</span><span class="pl-kos">;</span>
<span class="pl-k">import</span> <span class="pl-kos">{</span>
          <span class="pl-s1">clone</span><span class="pl-kos">,</span>
          <span class="pl-s1">defaults</span><span class="pl-kos">,</span>
          <span class="pl-s1">parseResponseHeaders</span><span class="pl-kos">,</span>
          <span class="pl-s1">createResult</span><span class="pl-kos">,</span>
          <span class="pl-s1">startsWith</span><span class="pl-kos">,</span>
          <span class="pl-s1">callHandlers</span>
        <span class="pl-kos">}</span>
        <span class="pl-k">from</span> <span class="pl-s">'./helpers'</span><span class="pl-kos">;</span>
<span class="pl-k">export</span> <span class="pl-k">default</span> <span class="pl-v">Pajax</span><span class="pl-kos">;</span>
<span class="pl-k">export</span> <span class="pl-c1">*</span> <span class="pl-k">from</span> <span class="pl-s">'./iri'</span><span class="pl-kos">;</span>
<span class="pl-k">export</span> <span class="pl-c1">*</span> <span class="pl-k">from</span> <span class="pl-s">'./qs'</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">I'm setting a <code class="notranslate">resolveModuleSource</code> function which is providing a normalized value for all of these dependencies.</p>
<p dir="auto">The resulting output looks like:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="System.register('github:n-fuse/pajax@0.1.7/pajax', ['npm:babel-runtime@5.1.11/helpers/create-class', 'npm:babel-runtime@5.1.11/helpers/class-call-check', 'npm:babel-runtime@5.1.11/helpers/define-property', 'npm:babel-runtime@5.1.11/core-js/promise', 'npm:babel-runtime@5.1.11/core-js/object/keys', 'github:n-fuse/pajax@0.1.7/iri', 'github:n-fuse/pajax@0.1.7/typeProcessors', 'github:n-fuse/pajax@0.1.7/qs', 'github:n-fuse/pajax@0.1.7/helpers', './iri', './qs'], function (_export) {
  // ...
});"><pre class="notranslate"><span class="pl-v">System</span><span class="pl-kos">.</span><span class="pl-en">register</span><span class="pl-kos">(</span><span class="pl-s">'github:n-fuse/pajax@0.1.7/pajax'</span><span class="pl-kos">,</span> <span class="pl-kos">[</span><span class="pl-s">'npm:babel-runtime@5.1.11/helpers/create-class'</span><span class="pl-kos">,</span> <span class="pl-s">'npm:babel-runtime@5.1.11/helpers/class-call-check'</span><span class="pl-kos">,</span> <span class="pl-s">'npm:babel-runtime@5.1.11/helpers/define-property'</span><span class="pl-kos">,</span> <span class="pl-s">'npm:babel-runtime@5.1.11/core-js/promise'</span><span class="pl-kos">,</span> <span class="pl-s">'npm:babel-runtime@5.1.11/core-js/object/keys'</span><span class="pl-kos">,</span> <span class="pl-s">'github:n-fuse/pajax@0.1.7/iri'</span><span class="pl-kos">,</span> <span class="pl-s">'github:n-fuse/pajax@0.1.7/typeProcessors'</span><span class="pl-kos">,</span> <span class="pl-s">'github:n-fuse/pajax@0.1.7/qs'</span><span class="pl-kos">,</span> <span class="pl-s">'github:n-fuse/pajax@0.1.7/helpers'</span><span class="pl-kos">,</span> <span class="pl-s">'./iri'</span><span class="pl-kos">,</span> <span class="pl-s">'./qs'</span><span class="pl-kos">]</span><span class="pl-kos">,</span> <span class="pl-k">function</span> <span class="pl-kos">(</span><span class="pl-s1">_export</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-c">// ...</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">That is, the duplicated names aren't being normalized properly.</p>
<p dir="auto">Note it should also be fine to dedupe dependencies at this level, as long as the first use order is maintained.</p>
<h2 dir="auto">Feature Request</h2>
<p dir="auto">I have an idea in my head. Not sure if it's already implemented.</p>
<p dir="auto">In JavaScript modules, Babel could detect same strings and create one small variable for that.<br>
Then It would replace those duplicates with that variable. It could prevent the JS engine from creating strings every single time.</p>
<p dir="auto">It might even decrease the file size. Like Google does  it with CSS class names.</p>
<h3 dir="auto">Example</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// Original
const doBlah = _ =&gt; {
    const arr = [
        { name: &quot;John&quot;, age: 19 },
        { name: &quot;Sophia&quot;, age: 12 },
        { name: &quot;Max&quot;, age: 45 }
    ];

    console.log(arr[0][&quot;name&quot;]);
    console.log(arr[1][&quot;name&quot;]);
    console.log(arr[2][&quot;name&quot;]);

    console.log(arr[0][&quot;age&quot;]);
    console.log(arr[1][&quot;age&quot;]);
    console.log(arr[2][&quot;age&quot;]);

    arr.push({ name: &quot;Kate&quot;, age: 23 });

    console.log(arr[3][&quot;name&quot;]);
    console.log(arr[3][&quot;age&quot;]);
};
"><pre class="notranslate"><span class="pl-c">// Original</span>
<span class="pl-k">const</span> <span class="pl-en">doBlah</span> <span class="pl-c1">=</span> <span class="pl-s1">_</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">const</span> <span class="pl-s1">arr</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span>
        <span class="pl-kos">{</span> <span class="pl-c1">name</span>: <span class="pl-s">"John"</span><span class="pl-kos">,</span> <span class="pl-c1">age</span>: <span class="pl-c1">19</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
        <span class="pl-kos">{</span> <span class="pl-c1">name</span>: <span class="pl-s">"Sophia"</span><span class="pl-kos">,</span> <span class="pl-c1">age</span>: <span class="pl-c1">12</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
        <span class="pl-kos">{</span> <span class="pl-c1">name</span>: <span class="pl-s">"Max"</span><span class="pl-kos">,</span> <span class="pl-c1">age</span>: <span class="pl-c1">45</span> <span class="pl-kos">}</span>
    <span class="pl-kos">]</span><span class="pl-kos">;</span>

    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">arr</span><span class="pl-kos">[</span><span class="pl-c1">0</span><span class="pl-kos">]</span><span class="pl-kos">[</span><span class="pl-s">"name"</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">arr</span><span class="pl-kos">[</span><span class="pl-c1">1</span><span class="pl-kos">]</span><span class="pl-kos">[</span><span class="pl-s">"name"</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">arr</span><span class="pl-kos">[</span><span class="pl-c1">2</span><span class="pl-kos">]</span><span class="pl-kos">[</span><span class="pl-s">"name"</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">arr</span><span class="pl-kos">[</span><span class="pl-c1">0</span><span class="pl-kos">]</span><span class="pl-kos">[</span><span class="pl-s">"age"</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">arr</span><span class="pl-kos">[</span><span class="pl-c1">1</span><span class="pl-kos">]</span><span class="pl-kos">[</span><span class="pl-s">"age"</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">arr</span><span class="pl-kos">[</span><span class="pl-c1">2</span><span class="pl-kos">]</span><span class="pl-kos">[</span><span class="pl-s">"age"</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

    <span class="pl-s1">arr</span><span class="pl-kos">.</span><span class="pl-en">push</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">name</span>: <span class="pl-s">"Kate"</span><span class="pl-kos">,</span> <span class="pl-c1">age</span>: <span class="pl-c1">23</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">arr</span><span class="pl-kos">[</span><span class="pl-c1">3</span><span class="pl-kos">]</span><span class="pl-kos">[</span><span class="pl-s">"name"</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">arr</span><span class="pl-kos">[</span><span class="pl-c1">3</span><span class="pl-kos">]</span><span class="pl-kos">[</span><span class="pl-s">"age"</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// Babel (Without converting back to es5)
const doBlah = _ =&gt; {
    const arr = [
        { name: &quot;John&quot;, age: 19 },
        { name: &quot;Sophia&quot;, age: 12 },
        { name: &quot;Max&quot;, age: 45 }
    ];

   // Extra variables
   var a = &quot;name&quot;, b = &quot;age&quot;;

    // Replacing strings with variables
    console.log(arr[0][a);
    console.log(arr[1][a]);
    console.log(arr[2][a]);

     //  Replacing strings with variables 
    console.log(arr[0][b]);
    console.log(arr[1][b]);
    console.log(arr[2][b]);

    arr.push({ name: &quot;Kate&quot;, age: 23 });

     //  Replacing strings with variables 
    console.log(arr[3][a]);
    console.log(arr[3][b]);
};"><pre class="notranslate"><span class="pl-c">// Babel (Without converting back to es5)</span>
<span class="pl-k">const</span> <span class="pl-en">doBlah</span> <span class="pl-c1">=</span> <span class="pl-s1">_</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">const</span> <span class="pl-s1">arr</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span>
        <span class="pl-kos">{</span> <span class="pl-c1">name</span>: <span class="pl-s">"John"</span><span class="pl-kos">,</span> <span class="pl-c1">age</span>: <span class="pl-c1">19</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
        <span class="pl-kos">{</span> <span class="pl-c1">name</span>: <span class="pl-s">"Sophia"</span><span class="pl-kos">,</span> <span class="pl-c1">age</span>: <span class="pl-c1">12</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
        <span class="pl-kos">{</span> <span class="pl-c1">name</span>: <span class="pl-s">"Max"</span><span class="pl-kos">,</span> <span class="pl-c1">age</span>: <span class="pl-c1">45</span> <span class="pl-kos">}</span>
    <span class="pl-kos">]</span><span class="pl-kos">;</span>

   <span class="pl-c">// Extra variables</span>
   <span class="pl-k">var</span> <span class="pl-s1">a</span> <span class="pl-c1">=</span> <span class="pl-s">"name"</span><span class="pl-kos">,</span> <span class="pl-s1">b</span> <span class="pl-c1">=</span> <span class="pl-s">"age"</span><span class="pl-kos">;</span>

    <span class="pl-c">// Replacing strings with variables</span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">arr</span><span class="pl-kos">[</span><span class="pl-c1">0</span><span class="pl-kos">]</span><span class="pl-kos">[</span><span class="pl-s1">a</span><span class="pl-kos"></span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">arr</span><span class="pl-kos">[</span><span class="pl-c1">1</span><span class="pl-kos">]</span><span class="pl-kos">[</span><span class="pl-s1">a</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">arr</span><span class="pl-kos">[</span><span class="pl-c1">2</span><span class="pl-kos">]</span><span class="pl-kos">[</span><span class="pl-s1">a</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

     <span class="pl-c">//  Replacing strings with variables </span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">arr</span><span class="pl-kos">[</span><span class="pl-c1">0</span><span class="pl-kos">]</span><span class="pl-kos">[</span><span class="pl-s1">b</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">arr</span><span class="pl-kos">[</span><span class="pl-c1">1</span><span class="pl-kos">]</span><span class="pl-kos">[</span><span class="pl-s1">b</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">arr</span><span class="pl-kos">[</span><span class="pl-c1">2</span><span class="pl-kos">]</span><span class="pl-kos">[</span><span class="pl-s1">b</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

    <span class="pl-s1">arr</span><span class="pl-kos">.</span><span class="pl-en">push</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">name</span>: <span class="pl-s">"Kate"</span><span class="pl-kos">,</span> <span class="pl-c1">age</span>: <span class="pl-c1">23</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

     <span class="pl-c">//  Replacing strings with variables </span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">arr</span><span class="pl-kos">[</span><span class="pl-c1">3</span><span class="pl-kos">]</span><span class="pl-kos">[</span><span class="pl-s1">a</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">arr</span><span class="pl-kos">[</span><span class="pl-c1">3</span><span class="pl-kos">]</span><span class="pl-kos">[</span><span class="pl-s1">b</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>