Any way to use webpack to load a resource at runtime?
<p>I have a single .json file that contains configuration stuff that I would like to reference from another script file using the typical import/require syntax. Currently I'm using webpack to resolve these dependencies and bundle them for me. This file however I want to be loaded at runtime and was hoping that there might be some type of loader that could resolve and load this file for me at runtime. So far I haven't found anything that matches my needs exactly.</p>

<p>Example:</p>

<pre><code>var jQuery = require('jQuery');
var sol = require('some-other-lib');
var myConfig = require('/real/production/url/myconfig.json');

console.log(myConfig.myFavoriteSetting);
</code></pre>

<p>In the example above I'd like to have <code>myconfig.json</code> resolved and loaded at runtime.</p>

<p>Possibly related questions:</p>

<ul>
<li><a href="https://stackoverflow.com/questions/33250174/how-to-use-webpack-to-load-cdn-or-external-vendor-javascript-lib-in-js-file-not">how to use webpack to load CDN or external vendor javascript lib in js file, not in html file</a></li>
<li><a href="https://stackoverflow.com/questions/31884135/webpack-dynamic-require-and-paths">Webpack - dynamic require and paths</a></li>
<li><a href="https://stackoverflow.com/questions/30575060/require-js-files-dynamically-on-runtime-using-webpack">Require JS files dynamically on runtime using webpack</a></li>
</ul>