title: Angular2 Typescript app throws 404 on components when js extension not specified
body: <p>I just started to play around with Angular2, and ran into a weird component file extension problem:</p>
  
  <p>Let's use the <a href="https://angular.io/docs/ts/latest/quickstart.html">5 minutes quickstart demo from angular.io</a> (I'll reproduce the code here for reference).</p>
  
  <p><strong>File structure</strong></p>
  
  <pre><code>angular2-quickstart
  |- app
  |  |- app.component.ts
  |  |- boot.ts
  |
  |- index.html
  |- package.json
  |- tsconfig.json
  </code></pre>
  
  <p><strong>package.json</strong></p>
  
  <pre><code>{
    "name": "angular2-quickstart",
    "version": "1.0.0",
    "scripts": {
      "tsc": "tsc",
      "tsc:w": "tsc -w",
      "lite": "lite-server",
      "start": "concurrent \"npm run tsc:w\" \"npm run lite\" "
    },
    "license": "ISC",
    "dependencies": {
      "angular2": "2.0.0-beta.0",
      "systemjs": "0.19.6",
      "es6-promise": "^3.0.2",
      "es6-shim": "^0.33.3",
      "reflect-metadata": "0.1.2",
      "rxjs": "5.0.0-beta.0",
      "zone.js": "0.5.10"
    },
    "devDependencies": {
      "concurrently": "^1.0.0",
      "lite-server": "^1.3.1",
      "typescript": "^1.7.3"
    }
  }
  </code></pre>
  
  <p><strong>tsconfig.json</strong></p>
  
  <pre><code>{
    "compilerOptions": {
      "target": "ES5",
      "module": "system",
      "moduleResolution": "node",
      "sourceMap": true,
      "emitDecoratorMetadata": true,
      "experimentalDecorators": true,
      "removeComments": false,
      "noImplicitAny": false
    },
    "exclude": [
      "node_modules"
    ]
  }
  </code></pre>
  
  <p><strong>app/app.component.ts</strong></p>
  
  <pre><code>import {Component} from 'angular2/core';
  
  @Component({
      selector: 'my-app',
      template: '&lt;h1&gt;My First Angular 2 App&lt;/h1&gt;'
  })
  export class AppComponent { }
  </code></pre>
  
  <p><strong>app/boot.ts</strong></p>
  
  <pre><code>import {bootstrap}    from 'angular2/platform/browser'
  import {AppComponent} from './app.component'
  
  bootstrap(AppComponent);
  </code></pre>
  
  <p><strong>index.html</strong></p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;html&gt;
  
    &lt;head&gt;
      &lt;title&gt;Angular 2 QuickStart&lt;/title&gt;
  
      &lt;!-- 1. Load libraries --&gt;
      &lt;script src="node_modules/angular2/bundles/angular2-polyfills.js"&gt;&lt;/script&gt;
      &lt;script src="node_modules/systemjs/dist/system.src.js"&gt;&lt;/script&gt;
      &lt;script src="node_modules/rxjs/bundles/Rx.js"&gt;&lt;/script&gt;
      &lt;script src="node_modules/angular2/bundles/angular2.dev.js"&gt;&lt;/script&gt;
  
      &lt;!-- 2. Configure SystemJS --&gt;
      &lt;script&gt;
        System.config({
          packages: {        
            app: {
              format: 'register',
              defaultExtension: 'js'
            }
          }
        });
        System.import('app/boot')
              .then(null, console.error.bind(console));
      &lt;/script&gt;
  
    &lt;/head&gt;
  
    &lt;!-- 3. Display the application --&gt;
    &lt;body&gt;
      &lt;my-app&gt;Loading...&lt;/my-app&gt;
    &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>This works like a charm, but exposes the whole file structure, including <code>node_modules</code> and the configuration, which seems like a bad idea.</p>
  
  <p>So I tried to expose only the <code>app</code> folder. To achieve that, I did the following:</p>
  
  <ul>
  <li>Copy the referenced javascript files in an <code>app/scripts</code> folder</li>
  <li>Move the <code>index.html</code> in <code>app</code></li>
  <li>Change the references paths in this file</li>
  <li>Change the <code>lite</code> script in <code>package.json</code> to <code>lite-server --baseDir app</code></li>
  </ul>
  
  <p>When running this, everything worked, except that <code>angular2-polyfills.js</code> returned : </p>
  
  <pre><code>Error: XHR error (404 Not Found) loading http://localhost:3000/app.component(…)
    run @ angular2-polyfills.js:138
    zoneBoundFn @ angular2-polyfills.js:111
    lib$es6$promise$$internal$$tryCatch @ angular2-polyfills.js:1511
    lib$es6$promise$$internal$$invokeCallback @ angular2-polyfills.js:1523
    lib$es6$promise$$internal$$publish @ angular2-polyfills.js:1494
    lib$es6$promise$$internal$$publishRejection @ angular2-polyfills.js:1444
    (anonymous function) @ angular2-polyfills.js:243
    run @ angular2-polyfills.js:138zoneBoundFn @ angular2-polyfills.js:111
    lib$es6$promise$asap$$flush @ angular2-polyfills.js:1305
  </code></pre>
  
  <p>Of course, if I ask for <code>http://localhost:3000/app.component.js</code> the file is returned correctly.</p>
  
  <p>So my question is: why doesn't the <code>.js</code> extension get appended to <code>app.component</code>, resulting in this error, where that worked when the server baseDir was the root of the project ? Did I miss some configuration option ?</p>