title: Implementing office-js into Angular4 using npm to allow offline capability
body: <p>I am looking to use office-js locally with angular 4 in an Excel Web based add-in. It will be installed and managed by npm. The calculator example shows that it is possible previously. <a href="https://code.msdn.microsoft.com/office/Apps-for-Office-Enable-bdcb7a2f#content" rel="nofollow noreferrer">Apps for Office: Enable offline apps</a>. </p>
  
  <p>I have installed office-js via <code>npm install @microsoft/office-js --save</code> and can see the JavaScript files in node_modules. </p>
  
  <p>The <a href="https://www.npmjs.com/package/@microsoft/office-js" rel="nofollow noreferrer">Microsoft npm example</a> says you should use a <code>&lt;script src="node_modules\@microsoft\office-js\dist\office.js"&gt;&lt;/script&gt;</code> but I am running into a few issues using Angular4:</p>
  
  <ul>
  <li><p>node_modules paths should not be revealed. <a href="https://stackoverflow.com/questions/27464168/how-to-include-scripts-located-inside-the-node-modules-folder">I saw some information about app.use and express</a> but this does not work after I use <code>ng build --prod --aot</code> as it no longer references the correct place for its src.</p></li>
  <li><p>if I use a grunt to push the office-js folder directly into the dist folder then I can get the  command to work in the header. The creates another problem where office.js injects a  below itself  tries to call another file from the office-js folder and uses an absolute path which includes the localhost. I would like that path to be relative to the office.js file but I have not figured that out yet.</p></li>
  <li><p>I have read that you can write <code>import 'office-js;'</code> or use the <code>import {Office} from '@microsoft/office-js'</code>. I tried injecting this at the top of main.ts, index.ts and even index.js but it either said that office-js is not a module or said nothing and I was not able to get Excel to communicate with the html. Where should this go? How does it get linked to the header of index.html if you import it as a module? Are you meant to have the @types/office-js if you are using the @microsoft/office-js?</p></li>
  </ul>
  
  <p>I am new to this and am looking for guidance. The aim is to have a Excel web addin that can perform offline as a standalone PWA (similar to the calculator). </p>
  
  <p>I understand VSTO is an option, but we will probably look to expand to a web based service in the future once the initial ideas has been demonstrated to work with old tools. Stepping stones. Any thoughts? </p>
  
  <p>The app will not be hosted on the store so I not concerned about the requirement to link to the CDN.</p>