<p dir="auto">I pass my proxy object to the axios.request() method and test everything with charles proxy but nothing happens. After some debugging i realized that the http adapter file is not packaged because it is not used.</p>
<p dir="auto">And the adapter is not used because of this code inside the defaults.js</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function getDefaultAdapter() {
  var adapter;
  if (typeof XMLHttpRequest !== 'undefined') {
    // For browsers use XHR adapter
    adapter = require('./adapters/xhr');
  } else if (typeof process !== 'undefined') {
    // For node use HTTP adapter
    adapter = require('./adapters/http');
  }
  return adapter;
}"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">getDefaultAdapter</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">adapter</span><span class="pl-kos">;</span>
  <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-k">typeof</span> <span class="pl-v">XMLHttpRequest</span> <span class="pl-c1">!==</span> <span class="pl-s">'undefined'</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-c">// For browsers use XHR adapter</span>
    <span class="pl-s1">adapter</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'./adapters/xhr'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span> <span class="pl-k">else</span> <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-k">typeof</span> <span class="pl-s1">process</span> <span class="pl-c1">!==</span> <span class="pl-s">'undefined'</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-c">// For node use HTTP adapter</span>
    <span class="pl-s1">adapter</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'./adapters/http'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>
  <span class="pl-k">return</span> <span class="pl-s1">adapter</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Can someone help me so i can use the proxy feature with react-native?</p>
<p dir="auto">The new 0.40.0 release of RN has broken axios for me.<br>
I've done two test cases in which I create a blank application, install axios, then import axios on the index page. The only difference between the two projects are the RN version number.</p>
<p dir="auto"><code class="notranslate">react-native init TestProject</code> (this is <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/latest/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/latest">@latest</a> which is currently 0.40.0)<br>
<code class="notranslate">cd TestProject</code><br>
<code class="notranslate">npm install axios --save</code><br>
I then go into the index.android.js file and add: <code class="notranslate">import axios from 'axios'</code><br>
<code class="notranslate">react-native run-android</code><br>
In this case, I get the following error:<br>
Unable to resolve module http from C:\ReactNative\Projects\TestProject\node_modules\axios\lib\adapters\http.js: Module does not exist in the module map or in these directories: C:\ReactNative\Projects\TestProject\node_modules.</p>
<p dir="auto">However, when I install an older version of RN like below, axios works fine.<br>
<code class="notranslate">rninit init TestProject --source react-native@0.39.2</code><br>
<code class="notranslate">cd TestProject</code><br>
<code class="notranslate">npm install axios --save</code><br>
I then go into the index.android.js file and add: <code class="notranslate">import axios from 'axios'</code><br>
<code class="notranslate">react-native run-android</code></p>
<p dir="auto">As a workaround to fix this I have downgraded my RN back down to 0.39.2 rather than using 0.40.0.</p>