title: Access static resource in server-side code in NextJs?
body: <p>Im using the static render feature of NextJS to generate a static version of my site thus I want to ensure that on the very first render of the page all the data it needs to render correctly is supplied.</p>
  
  <p>I have a number of blog posts which I have stored as .md files in /static and want to access them in a page such as:</p>
  
  <pre><code>import * as fs from "fs";
  ...
  
  export default class extends React.Component&lt;IProps, any&gt; {
  
    static async getInitialProps (props: IServerProps) {
      const post = (await getDb()).posts.find(p =&gt; p.id == props.query.id);
      const markdown = fs.readFileSync(`/static/posts/${post.markdownFileName}`);
      return { post, markdown }
    }
  ...
  </code></pre>
  
  <p>But if try to run the above I get the following error:</p>
  
  <p><code>This dependency was not found: * fs</code></p>
  
  <p>So im not sure how I should go about accessing these static resources while on the server..</p>