title: Next.js: How to get static assets from within getStaticProps
body: <p>I am using Netlify CMS. I want to import all the slides for a carousel into my component. I made a collection called slider and added a few slides. That created two markdown files (one for each slide) in <code>public/content/slider/</code>. I would like to import them all into an iteratable object so I can build the carousel.</p>
  <p>Because I have a webpack loader set up for markdown files, I can import a single markdown file no problem, like this:</p>
  <p><code>import post from '../public/content/posts/[post name].md</code></p>
  <p>But when I try to use <a href="https://webpack.js.org/guides/dependency-management/#requirecontext" rel="noreferrer">require.context</a>, <a href="https://www.npmjs.com/package/require-context" rel="noreferrer">require-context</a>, or import <code>fs</code>, it's no good. So I decide to try requiring those libs from within <code>getStaticProps</code>. But <code>__dirname</code> in <code>getStaticProps</code> is <code>/</code>, the root of my computer's filesystem.</p>
  <p>All the <code>getStaticProps</code> examples use data fetching. I'm missing some info. How can I import all the markdown files in the <code>/slides/</code> folder?</p>