title: Using an NPM dependency in an HTML page
body: <p>I'm currently working on a help and support form, and to make it easier to handle requests I need to retrieve some information about the user's connection (ping, upload, download). Until now we were redirecting our users to a website to do the test (<a href="https://www.speedtest.net/" rel="nofollow noreferrer">https://www.speedtest.net/</a>) but I found a dependency on NPM that allows to retrieve this information: <a href="https://www.npmjs.com/package/speedtest-net" rel="nofollow noreferrer">https://www.npmjs.com/package/speedtest-net</a></p>
  <p>I have never worked with NPM, and despite my research, my problem remains... The browser returns the same error every time : Uncaught ReferenceError: require is not defined (which I can understand, as require is not interpretable by the browser)...
  For the moment here is where I am, I'm not even sure of what I started, if someone could help me to solve this problem, it would be very nice :D</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang=&quot;fr&quot;&gt;
      &lt;head&gt;
          &lt;meta charset=&quot;utf-8&quot;&gt;
          &lt;title&gt;Speedtest - Test&lt;/title&gt;
  
          &lt;script type=&quot;module&quot; src=&quot;https://unpkg.com/speedtest-net@2.2.0/index.js&quot;&gt;&lt;/script&gt;
          &lt;script type=&quot;module&quot; src=&quot;https://unpkg.com/speedtest-net@2.2.0/bin/index.js&quot;&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          
          &lt;script&gt;
              (async () =&gt; {
                  try {
                      console.log(await speedTest());
                  } catch (err) {
                      console.log(err.message);
                  } finally {
                      process.exit(0);
                  }
              })();
          &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>