Skip to content

Change name of transpiled file if it matches the name of the output file to allow source maps to work #4301

Closed

Description

see systemjs/systemjs#636 (comment) for more details

from Guy Bedford (@guybedford) comments:

To see the in-browser transpilation, open for example https://github.com/systemjs/systemjs/blob/master/test/test-typescript.html, and see that the original ES6 is not present in comparison to others. Looking at the original source it seems like the reason is that the source map looks like:

{"version":3,"file":"es6-circular1.js","sourceRoot":"","sources":["es6-circular1.js"],"names":["p"],"mappings":";;QACW,CAAC,EACD,CAAC;IACZ;QACEA,EAAEA,CAACA,CAACA,CAACA,CAACA;YACJA,eAAAA,CAACA,GAAGA,oBAACA,CAAAA,CAACA;QACRA,IAAIA;YACFA,eAAAA,CAACA,GAAGA,oBAACA,CAAAA,CAACA;IACVA,CAACA;IALD,iBAKC,CAAA;;;;;;;YACD,CAAC,EAAE,CAAC"}

Where the sources and file name are the same. The point is that for in-browser transpilation we have to change the name of the transpiled source to source.js!transpiled so it can have a separate representation in the debugger, but the load.address argument provided to transpile at https://github.com/ModuleLoader/es6-module-loader/blob/master/src/transpiler.js#L78 becomes both the sources and file value.

Activity

  1. guybedford commented on Aug 17, 2015

    @guybedford
    Contributor

    Thanks for looking into this, as mentioned in systemjs/systemjs#636 (comment) it is actually working fine as-is. The sourceMappingURL on its own is enough to inform the debugging representation it seems.

  2. vladima commented on Aug 17, 2015

    @vladima
    Contributor

    closing as original issue is resolved

  3. added
    Won't FixThe severity and priority of this issue do not warrant the time or complexity needed to fix it
    on Aug 17, 2015
  4. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptWon't FixThe severity and priority of this issue do not warrant the time or complexity needed to fix it

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions