Office-js NPM package

Huff, Steve 0 Reputation points
2025-10-31T01:31:36.9133333+00:00

The Microsoft Office-JS NPM at https://www.npmjs.com/package/@microsoft/office-js says

"The NPM package associated with this repo is no longer officially supported."

Does this mean the NPM package will no longer provide the latest source code?

Since the CDN was down yesterday (10/29/25) our management wants us to now use a local copy in the future when the CDN goes down. The approach we were going to take was to install the NPM during builds and always reference that if the CDN is not responding. However, if the NPM is not going to have the latest then we are going to have to manage this by hand some how and download copies periodically and update them in our source code, which is not idea, but if that is the case where to we download the latest full copy from?

Microsoft 365 and Office | Development | Office JavaScript API
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Gabriel-N 7,855 Reputation points Microsoft External Staff Moderator
    2025-10-31T08:27:57.7166667+00:00

    Dear Huff, Steve

    Thank you for reaching out to the Q&A Forum.

    I completely understand your concern about ensuring reliability when the CDN is unavailable, especially after the recent outage. It’s a valid point and something many developers worry about when planning fallback strategies for Office.js.

    Based on my research, Microsoft states in @microsoft/office-js - npm “For the NPM package sourced through this repository, only the latest version of the package is supported. No support and no patches will be provided for previous versions of the package. The frequency of the updates to this repository and related NPM package to match the CDN version is not guaranteed.”  This implies that the update cadence is not guaranteed. As a moderator, I cannot confirm any future update cadence or guarantee synchronization between NPM and CDN, and I apologize for not being able to provide a definitive timeline. 

    For maintaining a local fallback copy, I found some community discussions suggesting that developers download the necessary files directly from the CDN and bundle them with their add-ins. For reference, please take a look at these threads: 

    However, there isn’t a single “full package” download like a ZIP because Office.js functions as a loader script that dynamically pulls in additional host-specific files (such as for Excel, Word, or Outlook) based on the runtime context. To implement this, you can download the main script directly from the CDN at https://appsforoffice.microsoft.com/lib/1/hosted/office.js, and for preview APIs, use https://appsforoffice.microsoft.com/lib/beta/hosted/office.js.

    Then, bundle these files with your add-in for offline scenarios.  

    For more details, please refer to the official documentation: Referencing the Office JavaScript API library - Office Add-ins | Microsoft Learn 

    As alternatives, you can use the OfficeDev/office-js GitHub repository for reference and issue tracking, but note that it’s not intended as a distribution source. There is also a Microsoft.Office.js package available on NuGet, but it is not officially supported for production environments. 

    The recommended best practice is to always use the CDN for production. For internal or secure environments, download from the CDN and host locally, updating manually when new versions are released. To keep your local copy current, you’ll need to repeat this process periodically, such as monthly or after known updates, by checking for any new or changed files. 

    Thank you again for raising this important question. 


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.