What does require.ensure do in the react starter kit page routing
<p>looking through the sample code from the react-starter-kit, I'm puzzled by what the statement <code>require.ensure([], (require) =&gt; resolve(require('./Admin').default), 'admin');</code> does.  I don't see that require.ensure is defined anywhere so I'm assuming it's a webpack function.</p>

<p>Is that an authorization check to make sure that the user has an admin role?  If so, where is the user info and role info being instanciated?</p>

<p>Is it instead only to make sure the admin component is instanciated?  What is the <code>.default</code> property and what is the string 'admin' being used for?</p>

<pre><code>import React from 'react';
import Layout from '../../components/Layout';

const title = 'Admin Page';
const isAdmin = false;

export default {

  path: '/admin',

  async action() {
    if (!isAdmin) {
      return { redirect: '/login' };
    }

    const Admin = await new Promise((resolve) =&gt; {
      require.ensure([], (require) =&gt; resolve(require('./Admin').default), 'admin');
    });

    return {
      title,
      chunk: 'admin',
      component: &lt;Layout&gt;&lt;Admin title={title} /&gt;&lt;/Layout&gt;,
    };
  },

};
</code></pre>