The official and supported way to use Office.js is via the Office Content Delivery Network (CDN). Do not use the npm package associated with this repository, as it is no longer officially supported. Referencing the CDN ensures your add-in receives the most up-to-date implementation and essential product updates automatically.
Add the following <script> tag within the <head> section of your HTML file:
<head>
...
<script src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js" type="text/javascript"></script>
</head>
Note: Government cloud environments may require a specific CDN URL. Refer to the official guidance for government cloud deployment for details.