<p dir="auto">I'm not sure if this is a duplicate of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="629758049" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/6061" data-hovercard-type="issue" data-hovercard-url="/denoland/deno/issues/6061/hovercard" href="https://github.com/denoland/deno/issues/6061">#6061</a>, But here's the problem.<br>
I'm on windows 10 using <code class="notranslate">deno 1.12.2 (release, x86_64-pc-windows-msvc)</code>, <code class="notranslate">v8 9.2.230.14</code>, <code class="notranslate">typescript 4.3.5</code>, and I have this file <code class="notranslate">DenoStd.ts</code> :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import * as Http from 'https://deno.land/std@0.103.0/http/mod.ts'
export { Http };"><pre class="notranslate"><code class="notranslate">import * as Http from 'https://deno.land/std@0.103.0/http/mod.ts'
export { Http };
</code></pre></div>
<p dir="auto">I'm behind a Socks5 proxy running on my localhost <code class="notranslate">127.0.0.1:1080</code> and I've tried setting related environment variables to these values :</p>
<ol dir="auto">
<li><code class="notranslate">http://127.0.0.1:1080/</code></li>
<li><code class="notranslate">https://127.0.0.1:1080/</code></li>
<li><code class="notranslate">socks5://127.0.0.1:1080/</code><br>
But none seem to work, and I get the following error when I reach the import line :</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="error: error sending request for url (https://deno.land/std@0.103.0/http/mod.ts): error trying to connect: tls handshake eof
    at file:///Bla/Bla/Bla/DenoStd.ts:1:0"><pre class="notranslate"><code class="notranslate">error: error sending request for url (https://deno.land/std@0.103.0/http/mod.ts): error trying to connect: tls handshake eof
    at file:///Bla/Bla/Bla/DenoStd.ts:1:0
</code></pre></div>
<p dir="auto">But if I set my proxy using Windows' proxy settings GUI (instead of environment variables) it works with no problem.</p>
<p dir="auto">Expected behavior is that environment variables also work, so maybe there's a bug there ? Or is it the case that Socks5 proxies are not supported somehow ??</p>
<p dir="auto">Referring to: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="627803473" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/5979" data-hovercard-type="issue" data-hovercard-url="/denoland/deno/issues/5979/hovercard" href="https://github.com/denoland/deno/issues/5979">#5979</a></p>
<p dir="auto">I'm trying to use React exported from <a href="https://esm.sh/" rel="nofollow">esm.sh</a> bundler service like this:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// myproject/src/deps/react.ts
export { default as React } from &quot;https://esm.sh/[react,react-dom]/react?dev&amp;no-check&quot;;

export { default as ReactDOM } from &quot;https://esm.sh/[react,react-dom]/react-dom?dev&amp;no-check&quot;;"><pre class="notranslate"><span class="pl-c">// myproject/src/deps/react.ts</span>
<span class="pl-k">export</span> <span class="pl-kos">{</span> <span class="pl-s1">default</span> <span class="pl-k">as</span> <span class="pl-smi">React</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">"https://esm.sh/[react,react-dom]/react?dev&amp;no-check"</span><span class="pl-kos">;</span>

<span class="pl-k">export</span> <span class="pl-kos">{</span> <span class="pl-s1">default</span> <span class="pl-k">as</span> <span class="pl-smi">ReactDOM</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">"https://esm.sh/[react,react-dom]/react-dom?dev&amp;no-check"</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">But this project should be depending on my other library, <a href="https://github.com/quaos/deno-html-react-transformer">html-react-transformer</a>, which in itself refers to the same React:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// /deno-html-react-transformer/src/deps/react.ts
export { default as React } from &quot;https://esm.sh/[react,react-dom]/react?dev&amp;no-check&quot;;"><pre class="notranslate"><span class="pl-c">// /deno-html-react-transformer/src/deps/react.ts</span>
<span class="pl-k">export</span> <span class="pl-kos">{</span> <span class="pl-s1">default</span> <span class="pl-k">as</span> <span class="pl-smi">React</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">"https://esm.sh/[react,react-dom]/react?dev&amp;no-check"</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">However, when using <code class="notranslate">deno bundle</code> the resulting JS has 2 duplicate React imports, and <code class="notranslate">Invalid hook call</code> error ensues.</p>
<p dir="auto">I'm trying something like this, which do not work:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// /deno-html-react-transformer/src/transformer.ts

import { React as BundledReact } from &quot;./deps/react.ts&quot;;

// HACK: Workaround for React typing
interface ReactInstanceProps {
    createElement(component: any, props: any, ...children: any): BundledReact.ReactNode;
    useState&lt;T&gt;(st: T): any;
    useEffect(callback: ReactUseEffectCallbackFunc, deps: any[]): any;
}
interface ReactUseEffectCallbackFunc {
    (): any;
}

export class Transformer {
  // ...
 
  public getComponent(React: ReactInstanceProps = BundledReact): TransformerComponent {
    return ({ source }: TransformerComponentProps) =&gt; {
      let [transformerReady, setTransformerReady] = React.useState&lt;boolean&gt;(this.initState);
      // ...
      
      return (transformerReady) ? this.transform(source, React) : null
    }
  }
}"><pre class="notranslate"><span class="pl-c">// /deno-html-react-transformer/src/transformer.ts</span>

<span class="pl-k">import</span> <span class="pl-kos">{</span> <span class="pl-smi">React</span> <span class="pl-k">as</span> <span class="pl-smi">BundledReact</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">"./deps/react.ts"</span><span class="pl-kos">;</span>

<span class="pl-c">// HACK: Workaround for React typing</span>
<span class="pl-k">interface</span> <span class="pl-smi">ReactInstanceProps</span> <span class="pl-kos">{</span>
    <span class="pl-c1">createElement</span><span class="pl-kos">(</span><span class="pl-s1">component</span>: <span class="pl-smi">any</span><span class="pl-kos">,</span> <span class="pl-s1">props</span>: <span class="pl-smi">any</span><span class="pl-kos">,</span> ...<span class="pl-s1">children</span>: <span class="pl-smi">any</span><span class="pl-kos">)</span>: <span class="pl-smi">BundledReact</span><span class="pl-kos">.</span><span class="pl-smi">ReactNode</span><span class="pl-kos">;</span>
    <span class="pl-c1">useState</span><span class="pl-c1">&lt;</span><span class="pl-smi">T</span><span class="pl-c1">&gt;</span><span class="pl-kos">(</span><span class="pl-s1">st</span>: <span class="pl-smi">T</span><span class="pl-kos">)</span>: <span class="pl-smi">any</span><span class="pl-kos">;</span>
    <span class="pl-c1">useEffect</span><span class="pl-kos">(</span><span class="pl-s1">callback</span>: <span class="pl-smi">ReactUseEffectCallbackFunc</span><span class="pl-kos">,</span> <span class="pl-s1">deps</span>: <span class="pl-smi">any</span><span class="pl-kos">[</span><span class="pl-kos">]</span><span class="pl-kos">)</span>: <span class="pl-smi">any</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>
<span class="pl-k">interface</span> <span class="pl-smi">ReactUseEffectCallbackFunc</span> <span class="pl-kos">{</span>
    <span class="pl-kos">(</span><span class="pl-kos">)</span>: <span class="pl-smi">any</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">export</span> <span class="pl-k">class</span> <span class="pl-smi">Transformer</span> <span class="pl-kos">{</span>
  <span class="pl-c">// ...</span>
 
  <span class="pl-k">public</span> <span class="pl-en">getComponent</span><span class="pl-kos">(</span><span class="pl-smi">React</span>: <span class="pl-smi">ReactInstanceProps</span> <span class="pl-c1">=</span> <span class="pl-smi">BundledReact</span><span class="pl-kos">)</span>: <span class="pl-smi">TransformerComponent</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-kos">(</span><span class="pl-kos">{</span> source <span class="pl-kos">}</span>: <span class="pl-smi">TransformerComponentProps</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
      <span class="pl-k">let</span> <span class="pl-kos">[</span><span class="pl-s1">transformerReady</span><span class="pl-kos">,</span> <span class="pl-s1">setTransformerReady</span><span class="pl-kos">]</span> <span class="pl-c1">=</span> <span class="pl-smi">React</span><span class="pl-kos">.</span><span class="pl-en">useState</span><span class="pl-kos">&lt;</span><span class="pl-smi">boolean</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">initState</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
      <span class="pl-c">// ...</span>
      
      <span class="pl-k">return</span> <span class="pl-kos">(</span><span class="pl-s1">transformerReady</span><span class="pl-kos">)</span> ? <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-en">transform</span><span class="pl-kos">(</span><span class="pl-s1">source</span><span class="pl-kos">,</span> <span class="pl-smi">React</span><span class="pl-kos">)</span> : <span class="pl-c1">null</span>
    <span class="pl-kos">}</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Is there any pending fix or workaround?<br>
Thanks!</p>