title: Exclude JSON files from the main bundle with webpack for react-lottie
body: <p>
  In our web app we have a few JSON files that are ~10-80k lines each. These are getting included in our main bundle. These are used by an animation plugin called react-lottie. </p>
  
  <p>An example of our <code>webpack.config.js</code></p>
  
  <pre class="lang-js prettyprint-override"><code>module.exports = {
    entry: ["./src/index.js"],
    module: {
      rules: [
        { test: /\.(js|jsx)$/, exclude: /node_modules/, use: ["babel-loader"] },
        {
          test: /\.(jpg|png|gif|ico)$/,
          use: {
            loader: "file-loader",
            options: { name: "[path][name].[hash].[ext]" }
          }
        }
      ]
    },
    resolve: { extensions: ["*", ".js", ".jsx"] },
    output: {
      path: __dirname + "/dist",
      publicPath: "/",
      filename: "[name].[hash].js"
    },
    plugins: [
      new webpack.HotModuleReplacementPlugin(),
      new HtmlWebpackPlugin({ hash: false, template: "src/index.html" }),
      new DashboardPlugin(),
      new CopyWebpackPlugin([
        {
          from: "src/components/Assets/BookingBar.js",
          to: "assets/BookingBar.js"
        }
      ]),
      new BundleAnalyzerPlugin()
    ],
    devServer: {
      contentBase: "./dist",
      hot: true,
      historyApiFallback: true,
      port: 4000
    }
  };
  </code></pre>
  
  <p>What is the expected behavior?</p>
  
  <p>There should be a way to exclude .json files from the main bundle. I've tried File-Loader, json-loader, and const someJson = require(./someJson)</p>
  
  <p>Other relevant information:
  webpack version: 4.16.1
  Node.js version: 10.12.0</p>
  
  <h2>Operating System: Mac OS 10.14 Mojave</h2>
  
  <p>ANSWER BELOW (AT LEAST FOR HOW I SOLVED IT). I couldn't initialize the lottie without any data.</p>