title: how to import require.cache and require.resolve
body: <ul>
  <li>Since i'm using module type in package.json or <code>import</code> instead of require.</li>
  <li>how can i import require.cache and require.resolve</li>
  <li>i'm trying to reload a file and update changes made.</li>
  </ul>
  <pre class="lang-js prettyprint-override"><code>// error: require is not defined
  delete require.cache[require.resolve(`./index.js`)];
  </code></pre>
  <ul>
  <li>I tried till now</li>
  </ul>
  <pre class="lang-js prettyprint-override"><code>// This runs with no issues but doesn't update the changes.
  import { resolve } from 'node:path';
  import { createRequire } from 'node:module';
  const require = createRequire(import.meta.url);
  delete require.cache[resolve(`./index.js`)];
  </code></pre>
  <ul>
  <li>without path</li>
  </ul>
  <pre class="lang-js prettyprint-override"><code>const require = createRequire(import.meta.url);
  delete require.cache[require.resolve(`./index.js`)];
  </code></pre>
  <ul>
  <li>But this doen't update the changes made in <code>index.js</code></li>
  </ul>
  <p>Expected Result</p>
  <ul>
  <li>If i reload specific file and it should update the changes made to file (<code>index.js</code>).</li>
  </ul>