TigrouMeow TigrouMeow - 1 year ago 84
TypeScript Question

Why is SystemJS is looking for source-map-support.js?

I have my whole setup here:

I believe it's quite clean, but it's not perfect. As it is, it works, but in the index.html file, try to switch those comments:


Basically, instead of using the compiled JS (performed automatically by Atom editor), we could load the app.ts directly but that doesn't work. SystemJS is looking for "source-map-support.js" and fails at it. I am not sure why I would need this dependency and I believe I have a configuration issue (or many of them).

You will probably see many things wrong in this project as well ;) Don't hesitate to tell me.

Thanks for your help.

Answer Source

In typescript 2.1, they added optional dependency on source-map-support - there is this function in typescript.js:

      tryEnableSourceMapsForHost: function() {
        try {
        } catch (e) {}

However, SystemJS can't detect that it's optional - in order to make require work in the browser, it scans source code for require calls, tries to load all required modules, and fails.

You can install source-map-support module, or you can simply map it to special module named @empty in jspm.config.js by adding this line to map:

"source-map-support": "@empty",

Then you also need to add defaultExtension: 'ts' to src package config, otherwise import { AppModule } from "./app.module"; will try to load app.module.js.

In all, the changed fragment in jspm.config.js looks like

    "src": {
      "defaultExtension": "ts",
      "meta": {
        "*.ts": {
          "loader": "plugin-typescript"

  map: {
    "source-map-support": "@empty",
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download