Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix T2864 #3108
This PR fixes issue 2864 as well as another, minor mistake.
Babel doesn't generate mappings for leading comments, but it assumes its own sourcemap can map any input position. Other tools, such as Typescript, do create mappings for leading comments. Babel's sourcemap can't handle those mappings, hence the "Invalid mapping." Fortunately, it's fine to omit them, which is what my patch does.
The second commit fixes the
Let me know if I need to reformat for code style or split this into two PRs. Thanks!
Current coverage is
I gave this a quick test locally and I had a minor issue with my initial setup throwing this error:
It turned out this was down to me having a file called
i.e. No actual code itself. (I believe I have this in place so Karma can use
However, once I moved the
Anyway - minor niggle aside this looks good to me. Hope it is merged soon. Thanks @cspotcode for your work!
I'd definitely like to fix this before merging. Also, I want to verify
By the way, does babel have an option to run with
added a commit
this pull request
Dec 3, 2015
No worries, merging this patch is still an improvement.
I just confirmed that the sourcemap does not map to intermediate sources. I suppose it's debatable whether or not it should; I think it should.
Sure @cspotcode. Clone this: https://github.com/johnnyreilly/TypeScript-Babel-6-Problems
You should see the error being thrown by webpack in the console. If you actually have something to import in
Then the code would work (assuming you're using the version that's just been merged). Without it, it doesn't. Apologies this this isn't more minimal but I'm time poor right now. Hopefully this is enough to get you going.