title: How use a config.json in root directory with React?
body: <p>I want to use a <strong>config.json</strong> file located in root directory in React. The reason of this is because i will need update this file json whitout rebuild project.</p>
  <p><strong>Project estructure:</strong></p>
  <pre><code>&gt; /build
  &gt; /node_modules
  &gt; /public
  &gt; /src
  &gt; config.json
  &gt; package.json
  ...ect.
  </code></pre>
  <p>What i try?</p>
  <p><strong>[Try 1] Import from root directory..</strong></p>
  <pre><code>import { configUrl } from &quot;./../../config.json&quot;;
  </code></pre>
  <p><strong>[Try 2] Add into dependencies</strong></p>
  <pre><code>&quot;@project-name&quot;: &quot;file:./config.json&quot;
  </code></pre>
  <p>And import into react component</p>
  <pre><code>import { configUrl } from &quot;@project-name&quot;;
  </code></pre>
  <p>To finally use fetch:</p>
  <pre><code>return fetch(configUrl, requestOptions)
      .then((response) =&gt; response.json())
      .then((result) =&gt; {
        console.log(result);
        return result;
      })
      .catch((error) =&gt; console.log(&quot;error&quot;, error));
  </code></pre>
  <p>But noone work, what more can i do?</p>