Search code examples
javascriptreactjsnpmoffice-jsoutlook-web-addins

How to safely update office-js-dependencies in react outlook-web-addin?


I have a react outlook addin and want to know how to update the addin to the latest office-js-dependencies. There's a documentation but I can't make head nor tail of it.

I think I have to change the versions in my package.json. But there's nothing about it in the documentation.

Here are the dev-deps in my package.json:

    "@types/office-js": "^1.0.37",
    "@types/office-runtime": "^1.0.8",
    "office-addin-cli": "^1.0.3",
    "office-addin-debugging": "^3.0.17",
    "office-addin-dev-certs": "^1.4.10",
    "office-addin-lint": "^1.0.15",
    "office-addin-manifest": "^1.4.13",
    "office-addin-prettier-config": "^1.0.10",

Should I keep them up to date manually? In my manifest.xml are the links to the newest version.


Solution

  • Based on those dependencies, I'm assuming your add-in project was created by yo office.

    Updating those dev dependencies (via npm install) will only affect the development experience and not the runtime of the add-in. The main benefit to updating the types dependencies will be as new APIs are added, you will be able to call them from TypeScript code. And if you use the manifest validation functionality provided by yo office, updating the dependencies will include any updates to the manifest schema used for validation.

    The linked documentation refers to two updates that you won't need to do because the add-in created by yo office already uses manifest schema version 1.1. In particular, so long as Office.js is loaded from the CDN location, your add-in will always use the latest version of the Office.js API.