<p dir="auto"><strong>TypeScript Version:</strong></p>
<p dir="auto">1.8.2</p>
<p dir="auto"><strong>Code</strong></p>
<p dir="auto">foo.ts</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var foo: number = &quot;s&quot;;"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">foo</span>: <span class="pl-smi">number</span> <span class="pl-c1">=</span> <span class="pl-s">"s"</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">tsconfig.json</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
    &quot;compilerOptions&quot;: {
        &quot;module&quot;: &quot;commonjs&quot;,
        &quot;target&quot;: &quot;es5&quot;
    },
    &quot;exclude&quot;: [
        &quot;foo.ts&quot;
    ]
}"><pre class="notranslate">{
    <span class="pl-ent">"compilerOptions"</span>: {
        <span class="pl-ent">"module"</span>: <span class="pl-s"><span class="pl-pds">"</span>commonjs<span class="pl-pds">"</span></span>,
        <span class="pl-ent">"target"</span>: <span class="pl-s"><span class="pl-pds">"</span>es5<span class="pl-pds">"</span></span>
    },
    <span class="pl-ent">"exclude"</span>: [
        <span class="pl-s"><span class="pl-pds">"</span>foo.ts<span class="pl-pds">"</span></span>
    ]
}</pre></div>
<p dir="auto"><strong>Expected behavior:</strong></p>
<p dir="auto">In an NTVS typescript console application using the above tsconfig.json, and a file foo.ts containing an error, the build and run initiated by Visual Studio should succeed because the file containing the error is excluded.</p>
<p dir="auto"><strong>Actual behavior:</strong></p>
<p dir="auto">The build fails with an error in foo.ts. Compiling from command line, the build succeeds. Also, if foo.ts is put inside a folder, and the folder is listed in the exclude array, the VS build succeeds.</p>
<p dir="auto">This is currently breaking projects using the typings tool, because it generates two sets of type definitions, and the other set cannot be excluded.</p>
<p dir="auto">Hi,</p>
<p dir="auto">I think that the <code class="notranslate">///&lt;amd-dependency /&gt;</code> functionality exhibits odd behavior when combined with an ES6 import.</p>
<p dir="auto">For example, this TypeScript code:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="/// &lt;amd-dependency name=&quot;jquery&quot; path=&quot;/jquery/jquery.min.js&quot; /&gt;
import 'jquery';

$('#myDiv').html('Hello');"><pre class="notranslate"><span class="pl-c">/// &lt;amd-dependency name="jquery" path="/jquery/jquery.min.js" /&gt;</span>
<span class="pl-k">import</span> <span class="pl-s">'jquery'</span><span class="pl-kos">;</span>

<span class="pl-en">$</span><span class="pl-kos">(</span><span class="pl-s">'#myDiv'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">html</span><span class="pl-kos">(</span><span class="pl-s">'Hello'</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">emits as this JS when using AMD module mode:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="define([&quot;require&quot;, &quot;exports&quot;, &quot;/jquery/jquery.min.js&quot;, 'jquery'], function (require, exports, jquery) {
    $('#myDiv').html('Hello');
});"><pre class="notranslate"><span class="pl-en">define</span><span class="pl-kos">(</span><span class="pl-kos">[</span><span class="pl-s">"require"</span><span class="pl-kos">,</span> <span class="pl-s">"exports"</span><span class="pl-kos">,</span> <span class="pl-s">"/jquery/jquery.min.js"</span><span class="pl-kos">,</span> <span class="pl-s">'jquery'</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">require</span><span class="pl-kos">,</span> <span class="pl-s1">exports</span><span class="pl-kos">,</span> <span class="pl-s1">jquery</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-en">$</span><span class="pl-kos">(</span><span class="pl-s">'#myDiv'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">html</span><span class="pl-kos">(</span><span class="pl-s">'Hello'</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>
<p dir="auto">In the emitted JS, the string 'jquery' is included in the requirements for the module (causing an HTTP 404 error at runtime).  My expectation would be that 'jquery' here would be considered the same as the 'jquery' inside the amd-dependency comment, so it would be de-duplicated and that only "/jquery/jquery.min.js" would be passed along to the emitted JS.</p>
<p dir="auto">I can simply remove the ES6-style import and the emit works as expected.</p>
<p dir="auto">Am I crazy on this?</p>
<p dir="auto">I know this will probably be moot once <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="60991541" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/2338" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/2338/hovercard" href="https://github.com/microsoft/TypeScript/issues/2338">#2338</a> hits.</p>
<p dir="auto">Possibly related: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="96883672" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/4004" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/4004/hovercard" href="https://github.com/microsoft/TypeScript/issues/4004">#4004</a>.</p>