title: Importing pdf file inside map function
body: <p>I have my publication list defined in JSON as follow:</p>
  <pre><code>[
      {
          &quot;title&quot;: &quot;Title 2&quot;,
          &quot;authors&quot;: &quot;Author1, Author2&quot;,
          &quot;abstract&quot;: &quot;Lorem Ipsum.&quot;,
          &quot;year&quot;: 2021,
          &quot;venue&quot;: &quot;Venue&quot;,
          &quot;pdf&quot;: &quot;../../assets/1.pdf&quot;
      },
      {
          &quot;title&quot;: &quot;Title 2&quot;,
          &quot;authors&quot;: &quot;Author 1, Authot 2&quot;,
          &quot;abstract&quot;: &quot;Lorem Ipsum.&quot;,
          &quot;year&quot;: 2022,
          &quot;venue&quot;: &quot;CVPR&quot;,
          &quot;pdf&quot;: &quot;../../assets/2.pdf&quot;
      }
      
  ]
  
  </code></pre>
  <p>I use map to create separate publication blocks on my website as follow:</p>
  <pre><code>import &quot;./Publications.css&quot;
  import PublicationList from &quot;../../assets/publications.json&quot;
  
  import {AiFillFilePdf} from 'react-icons/ai'
  import {RiFilePaperLine} from &quot;react-icons/ri&quot;
  
  const Publications = (props) =&gt; {
  
      return(
          &lt;div className=&quot;section-container&quot;&gt;
              &lt;div className=&quot;container-row&quot;&gt;
                  &lt;h1&gt;Publications&lt;/h1&gt;
              &lt;/div&gt;
  
              &lt;div id=&quot;publications-body&quot; className=&quot;container-row&quot;&gt;
                  {
                      PublicationList.map(publication =&gt; {
                          return(
                              &lt;div className=&quot;publication&quot;&gt;
                                  &lt;div className=&quot;publication-text&quot;&gt;
                                      &lt;b&gt;{publication.title}&lt;/b&gt;
                                      &lt;br /&gt;
                                      {publication.authors}
                                      &lt;br /&gt;
                                      &lt;i&gt;{publication.venue}&lt;/i&gt;, {publication.year}
                                  &lt;/div&gt;
                                  &lt;div className=&quot;publication-icons&quot;&gt;
                                      &lt;a href={require(publication.pdf)} target=&quot;_blank&quot; rel=&quot;noreferrer&quot;&gt;&lt;AiFillFilePdf /&gt;&lt;/a&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          )
                      })
                  }
              &lt;/div&gt;
          &lt;/div&gt;
      );   
  }
  
  export default Publications
  </code></pre>
  <p>However, in my console I get an error: [Error] Error: Cannot find module '../../assets/1.pdf'. What am I doing wrong?</p>