title: Import csv into Nextjs and read with d3
body: <p>I'm having trouble importing csv data into my nextjs app to read with d3.</p>
  <p>I understand that static files must be in the public directory and only absolute paths will work, but although I get the absolute path with process.cwd(), it doesn't seem to find the file. I can't import the csv at the top of the js file either?</p>
  <p>My index.js is</p>
  <pre><code>import { useState, useEffect } from 'react'
  import path from 'path'
  import Head from 'next/head'
  import { csv }  from &quot;d3&quot;
  
  export async function getStaticProps(context) {
  
    const dataPath = path.join(process.cwd(), 'public/data/harry_potter.csv')
    console.log(&quot;DATA PATH: &quot;, typeof dataPath)
    const data = await csv(dataPath)
  
    console.log(&quot;DATA&quot;, data)
  
    if (!data) {
      return {
        notFound: true,
      }
    }
  
    return {
      props: {}, // will be passed to the page component as props
    }
  }
  
  export default function Home(props) {  
  
    useEffect(() =&gt; {
      console.log(&quot;DATA&quot;, props)
  
    }, [])
  
    return (
      &lt;div className=&quot;container&quot;&gt;
        &lt;Head&gt;
          &lt;title&gt;d3 exercise&lt;/title&gt;
        &lt;/Head&gt;
  
        &lt;main&gt;
          
        &lt;/main&gt;
      &lt;/div&gt;
    )
  }
  </code></pre>
  <p>My path is:</p>
  <pre><code>C:\Users\david\Documents\d3-pluralsight\ex1\public\data\harry_potter.csv
  </code></pre>
  <p>And the nextjs app directory is</p>
  <pre><code>C:\Users\david\Documents\d3-pluralsight\ex1
  </code></pre>
  <p>But I still get:</p>
  <pre><code>TypeError: Only absolute URLs are supported
  </code></pre>
  <p>I can't import like this either</p>
  <pre><code>import harry from '../public/data/harry_potter.csv'
  </code></pre>
  <p>Am I missing something? Does Next not recognise csv files without extra config?</p>
  <p>EDIT: using csv-loader loads the csv, but doesn't give access to d3's powerful type conversion functions. If I just write my own function js runs out of memory with csvs with 20000 rows</p>