frankwallis / plugin-typescript

TypeScript loader for SystemJS
MIT License
248 stars 47 forks source link

"source-map-support.js 404 (Not Found)" #178

Closed jordymeow closed 7 years ago

jordymeow commented 8 years ago

Hello,

I am not sure it's really related to plugin-typescript but it always happen when I am trying to load my files through the typescript loader. My code is available here: https://github.com/jordymeow/meowbs-2016. I get this error in the Chrome console when I run this project. Do you have any idea what's happening?

aluanhaddad commented 8 years ago

I ran into this also. You can resolve the issue by running jspm i --dev npm:source-map-support.

I'm not sure what the right way to go about fixing the problem is because it's not listed as a dependency in TypeScript's package.json but from looking at the source code, the compiler is conditionally requiring it by wrapping it in a try block but that doesn't work in the browser environment where it results in an async 404.

This was introduced at some point during development of 2.1

The simplest solution is probably to modify the override in the jspm registry.

@frankwallis what do you think?

jordymeow commented 8 years ago

Thank you @aluanhaddad, indeed it works fine. Would be great to know why we need to install it, and why it's not listed as a dependency.

aluanhaddad commented 8 years ago

I think the reason that it's not listed as a dependency is that it is intended to be optional. The way that optionality is handled is via a try catch block around what is assumed to be a synchronous require.

From my limited understanding, I don't think that is really something SystemJS and jspm can reasonably be expected to detect and even if they could, the only thing that could preserve the behavior would be a non-trivial source transform.

I could be completely wrong and the issue could instead be related to other dependencies that are deliberately omitted from TypeScript via the jspm registry override.

@guybedford is my interpretation correct or is there a known way that jspm has for handling this scenario?

aluanhaddad commented 8 years ago

This should fix the issue temporarily https://github.com/jspm/registry/pull/997

aluanhaddad commented 7 years ago

@jordymeow This should be fixed now.

jordymeow commented 7 years ago

@aluanhaddad I will test it tomorrow, thanks a lot :)