title: With NextJS, I want to programmatically access assetPrefix from next.config.js
body: <p>I include in my <code>_document.js</code> several static files and fonts that I want to put prefix with <code>assetPrefix</code> if there is one specified in <code>next.config.js</code>. My current <code>next.config.js</code> is as following:</p>
  
  <pre><code>module.exports = (phase) =&gt; {
          return withTypescript(
              withCSS(
                  withImages(
                      withOffline({
                          env,
                          useFileSystemPublicRoutes: false,
                          assetPrefix: isProd ? 'https://d28d4ipdckjadl.cloudfront.net' : '',
                          inlineImageLimit: 16384,
                          ...
  </code></pre>
  
  <p>That is, my <code>_document.js</code> has code like the following:</p>
  
  <pre><code>&lt;link
      rel="stylesheet"
      type="text/css"
      href={'/static/bootstrap.css'}
   /&gt;
  </code></pre>
  
  <p>I think it might be webpack thing so I'm tagging that also.</p>