title: Is <script src=""></script> the right way to use JavaScript libraries in a front-end project?
body: <p>For a lot of JavaScript projects, such as Bootstrap (well you may argue that it is just a CSS framework, anyway this is not the point), the <a href="https://getbootstrap.com/docs/5.1/getting-started/download/" rel="nofollow noreferrer">installation section</a> comes two ways.</p>
  <p>The first way is usually like this:</p>
  <pre><code>npm install bootstrap
  </code></pre>
  <p>and the second way is the one I know:</p>
  <pre><code>&lt;link href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot; integrity=&quot;sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3&quot; crossorigin=&quot;anonymous&quot;&gt;
  &lt;script src=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js&quot; integrity=&quot;sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
  </code></pre>
  <p>My understanding is that <code>npm</code> is the right way to go if I am using <code>node.js</code> to do back-end development. Suppose I am using other backends (say, Python, Java) and JavaScript is run only on the client's browser, I should stick with the <code>&lt;script src=&quot;&quot;&gt;&lt;/script&gt;</code> approach. Is this generally correct?</p>
  <p>Another closely related question is about the use of import statement, such as <code>import bootstrap from 'bootstrap'</code>. My understanding is that this syntax only works for the <code>node.js</code> backend and I cannot use it on an HTML page without a lot of extra effort. Is this understanding correct?</p>