title: angular2 how to bundle a UMD module without ng2 dependencies
body: <p>I'm trying to use rollup to bundle an ng2 module using UMD, but the ng2 dependencies are not being excluded as I intended:</p>
  
  <p><strong>Rollup Options:</strong></p>
  
  <pre><code>{
      format: "umd",
      moduleName: "mymodule",
      dest: "dist/app.bundle.umd.js",
      sourceMap: true
  }
  </code></pre>
  
  <p><strong>Node Resolve Plugin</strong> (rollup-plugin-node-resolve)</p>
  
  <pre><code>nodeResolve({
      jsnext: true,
      module: true,
      skip: [
          "@angular/common",
          "@angular/compiler",
          "@angular/compiler-cli",
          "@angular/core",
          "@angular/forms",
          "@angular/http",
          "@angular/platform-browser",
          "@angular/platform-browser-dynamic",
          "@angular/platform-server",
          'rxjs'
      ]
  }),
  </code></pre>
  
  <p>The output of this is:</p>
  
  <pre><code>exports.AppModule = __decorate([
  _angular_core.NgModule({
      imports: [
          _angular_platformBrowser.BrowserModule,
          _angular_http.HttpModule
      ],
      declarations: [AppComponent],
      providers: [],
      bootstrap: [AppComponent],
      exports: [AppComponent]
  })], exports.AppModule);
  </code></pre>
  
  <p>By skipping ng2 dependencies, it seems Rollup created global dependencies, where <code>_angular_core</code>, <code>_angular_http</code> and <code>_angular_platformBrowser</code> need to be defined globally.</p>
  
  <p>I want the dependencies to be preserved but not as global dependencies. For example, this is what <code>tsc</code> produces, when targeting <code>umd</code>:</p>
  
  <pre><code>"use strict";
  var core_1 = require("@angular/core");
  var app_component_1 = require("./app.component");
  var platform_browser_1 = require("@angular/platform-browser");
  var http_1 = require("@angular/http");
  var AppModule = (function () {
      function AppModule() {
      }
      return AppModule;
  }());
  AppModule = __decorate([
      core_1.NgModule({
          imports: [
              platform_browser_1.BrowserModule,
              http_1.HttpModule
          ],
          declarations: [app_component_1.AppComponent],
          providers: [],
          bootstrap: [app_component_1.AppComponent],
          exports: [app_component_1.AppComponent]
      })
  ], AppModule);
  exports.AppModule = AppModule;
  </code></pre>
  
  <p>You can see that the <code>require</code> statements are embedded in the UMD module (this is what I'm trying to achieve), rather than having global dependencies defined.</p>
  
  <p>I am probably not using rollup correctly. What am I doing wrong? </p>
  
  <p>Perhaps Rollup is the wrong tool for this, is there a better tool someone can recommend?  I am using gulp for my build.</p>