title: Referencing a local file within npm package
body: <p>How do we reference local files within npm package? Since the npm package is installed by another consumer, would these references become obsolete with respect to the root folder of consumer?</p>
  
  <p>For example, I have created a npm package for angular. This package also reships few html and css files from a third party(They do not have angular packages). I made sure the files are copied to <code>...dist\thirdparty</code> during package publish. I would like to reference some of these files within my npm package using relative path or other mechanisms.</p>
  
  <p>E.g</p>
  
  <pre><code>@Component({
  selector: 'ng2-my-library',
  template: '&lt;div&gt;&lt;/div&gt;'
  })
  export class MyLibraryComponent {
  .....
  var newWindowUrl = "./thirdparty/some.html"; **// Need to relatively locate some.html here**
  window.open(newWindowUrl);
  .....
  }
  </code></pre>
  
  <p>After I install <code>my-package</code> to a sample angular application, the above code results in <code>"localhost:3000/thirdparty/some.html"</code>, which is inaccurate.</p>
  
  <p>How do I do this?</p>
  
  <p>After installing my package, the consumer will have this structure<br>
  <code>consumerApp
    node_modules(Folder)
      ng2-my-library(Folder)
        ng2-pdfjs-viewer.umd.js // This is where I need to access some.html
        thirdparty(Folder)
          some.html</code></p>
  
  <p>I also considered instructing consumers of the package to do something like this, but this instruction is quite dependant on other build tools to copy or redirect to the html, which is not what I want.</p>
  
  <pre><code>   var TransferWebpackPlugin = require('transfer-webpack-plugin');
           ...
           plugins: [
             new TransferWebpackPlugin([
               { from: 'node_modules/my-package/assets', to: path.join(__dirname, 'my/public') }
             ])
           ] 
  </code></pre>
  
  <p>I also tried to use this package. Apparently it did not provide me proper results for html.
  <a href="https://www.npmjs.com/package/static-reference" rel="nofollow noreferrer">https://www.npmjs.com/package/static-reference</a></p>