Skip to content

typescript + babel chokes on sourceMap #98

@andrenarchy

Description

@andrenarchy

In my project with jspm 0.17.0-beta.5 (typescript+babel), the compilation errors out with

Error on translate for src/index.ts at file:///tmp/jspm-test/src/index.ts
  TypeError: file:///tmp/jspm-test/src/index.ts: Cannot assign to read only property 'mappings' of {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,kBAAkB;;;;;;;;;;;;;;OAEX,EAAC,GAAG,EAAE,KAAK,EAAC,MAAM,SAAS;AAElC,MAAM,IAAI,GAAW,SAAS,CAAC;AAE/B,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;AAE9B,CAAC;;QACC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACtB,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;CAAA,CAAC,EAAE,CAAC;AAEL,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC"}
    at eval (file:///tmp/jspm-test/jspm_packages/npm/[email protected]/systemjs-babel-node.js:7749:29)
    at File.mergeSourceMap (file:///tmp/jspm-test/jspm_packages/npm/[email protected]/systemjs-babel-node.js:7751:11)
    at File.generate (file:///tmp/jspm-test/jspm_packages/npm/[email protected]/systemjs-babel-node.js:7916:27)
    at File.transform (file:///tmp/jspm-test/jspm_packages/npm/[email protected]/systemjs-babel-node.js:7787:19)
    at eval (file:///tmp/jspm-test/jspm_packages/npm/[email protected]/systemjs-babel-node.js:3904:21)
    at File.wrap (file:///tmp/jspm-test/jspm_packages/npm/[email protected]/systemjs-babel-node.js:7798:18)
    at Pipeline.transform (file:///tmp/jspm-test/jspm_packages/npm/[email protected]/systemjs-babel-node.js:3901:19)
    at eval (file:///tmp/jspm-test/jspm_packages/npm/[email protected]/plugin-babel.js:133:24)

It's failing in the babel plugin but the error disappears when I set "sourceMap": false in tsconfig.json so I assume that the problem is actually in the typescript plugin (which runs before babel). Maybe you can take a look at the code? Let me know if I can be of help for tracking down the issue!

It would certainly be great to re-enable sourcemaps in my project. 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions