Search code examples
outlookoffice-jsoutlook-addinoffice-addinsoutlook-web-addins

Outlook add-in Production and Development deployment


I created an react-outlook add-in using the yeoman generator and successfully deployed the war file in the oracle web logic server.

However, whenever I make small changes I need to create a new war file and deploy it again and again to test the add-in. I cannot test the add-in when it is deployed in the localhost due to CORS policy errors (Cannot call APIs).

Since, creating war files and deploying them again and again in the server is a tedious process, is there a way to easily test the add-in or a way to make the same process a bit easy?

Currently, I'm following these steps whenever I make a change in the code that needs to be tested.

  1. Create the dist folder (npm run build)
  2. Generate the war file
  3. Copy the war file in my local folder and paste it in the network folder
  4. Publish it in the oracle server

If it helps, I can see following two lines in the webpack.config.js file as well

const urlDev = "https://localhost:3000/";
const urlProd = "https://www.contoso.com/"; // CHANGE THIS TO YOUR PRODUCTION DEPLOYMENT LOCATION

Thank you in advance!


Solution

  • You can use webpack to automate the process of generating and copying the war file to the dist folder.

    The URLs mentioned in your post are used when you build a debug or release version of the add-in. Depending on that the manifest file contains the appropriate URLs, so you could run it locally or from any web server.

    As for CORS, see Addressing same-origin policy limitations in Office Add-ins for possible solutions.