title: Instead change the require of index.js, to a dynamic import() which is available in all CommonJS modules
body: <p>Trying to work with node/javascript/nfts, I am a noob and followed along a tutorial, but I get this error:</p>
  <pre><code>error [ERR_REQUIRE_ESM]: require() of ES Module [...] is not supported. Instead change the require of index.js [ in my file...]  to a dynamic import() which is available in all CommonJS modules
  </code></pre>
  <p>My understanding is that they've updated the node file, so i need a different code than that in the tutorial, but i don't know which one I'm supposed to change, where and to what. Please be as specific as you can</p>
  <pre><code>const FormData = require('form-data');
  const fetch = require('node-fetch');
  const path = require(&quot;path&quot;)
  const basePath = process.cwd();
  const fs = require(&quot;fs&quot;);
  
  fs.readdirSync(`${basePath}/build/images`).foreach(file).forEach(file =&gt; {
      const formData = new FormData();
      const fileStream = fs.createReadStream(`${basePath}/build/images/${file}`);
      formData.append('file',fileStream);
  
      let url = 'https://api.nftport.xyz/v0/files';
  
      let options = {
        method: 'POST',
        headers: {
          Authorization: '[...]',
        },
        body: formData
      };
      
      fetch(url, options)
        .then(res =&gt; res.json())
        .then(json =&gt; {
         const fileName = path.parse(json.file_name).name;
         let rawdata = fs.readFileSync(`${basePath}/build/json/${fileName}.json`);
         let metaData = JSON.parse(rawdata);
  
         metaData.file_url = json.ipfs_url;
  
         fs.writeFileSync(`${basePath}/build/json${fileName}.json`, JSON.stringify(metaData, null, 2));
  
         console.log(`${json.file_name} uploaded &amp; ${fileName}.json updated!`);
        })
        .catch(err =&gt; console.error('error:' + err));
  })
  
  </code></pre>