-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An error occurred while trying to read the map file #15
Comments
The first line of this function Line 56 seems to be the culprit: function compile(base, code, filename) {
var sourcemap = convertSourceMap.fromMapFileSource(code, '.').toObject();
code = convertSourceMap.removeMapFileComments(code);
var babelOutput = babel.transform(code, getBabelOpts(filename, sourcemap));
// babelOutput has a bunch of undocumented stuff on it. Just grab what we need to save memory
outputs[filename] = { code: babelOutput.code, map: babelOutput.map };
return base.call(this, babelOutput.code, filename);
} This tries to extract a file name from the source-map comment, however this module outputs source-maps as base64 encoded comments. Changing line 56 to the following fixes the issue: < var sourcemap = convertSourceMap.fromMapFileSource(code, '.').toObject();
---
> var sourcemap = convertSourceMap.fromSource(code).toObject(); Happy to make a pull request, although I'd like to know how this issue doesn't already exist because it's made the module absolutely unusable for myself. |
I've found out what's caused the issue in the first place. I was using the most recent version of ts-node 3.2.0, ts-babel-node requires ^3.0.6. In 3.1.0 there was a change which emitted source-maps inline rather than to a separate file cache. I've forked the repo and intend on making the fix and upgrading to ts-node 3.2.0. |
Ok, you can't upgrade to 3.2.0 because there's a bug where it doesn't work for Will leave this here for now, wait until ts-node have fixed their issues |
Cheers! This unblocked me after a few hours of tearing my hair out! |
Found here danielmoore#15
I got the same problem, any news about fix? |
Pretty sure the creator isn't active on this anymore, I've had a Pull Request open since July which hasn't been looked at. I'd say fork my fork https://github.com/dan-j/ts-babel-node (don't use mine, I might forget and delete it someday) it was July when I last committed to it but it fixes the issues discussed here. I'm no longer using it so won't be active on it, but I'll respond to messages if need be. |
Using version 1.1.1, I get the following error and can't get round it. Downgrading to 1.1.0 fixes the issue.
It's reproducible on the most trivial example:
$ yarn add -D ts-babel-node
index.ts:
$ ts-babel-node index.ts
The text was updated successfully, but these errors were encountered: