Uncaught TypeError: URL is not a constructor using WHATWG URL object support for electron : <p>I am trying to read a file using WHATWG URL object support <a href="https://nodejs.org/api/fs.html#fs_whatwg_url_object_support" rel="noreferrer">here</a></p>

<p>and I am getting this error: Uncaught TypeError: URL is not a constructor</p>

<p>here is my code:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var fs = require("fs");                                     
const { URL } = require('url');
var dbPath = 'file://192.168.5.2/db/db.sqlite';
const fileUrl = new URL(dbPath);</code></pre>
</div>
</div>
</p>
