jeron-diovis
jeron-diovis

Reputation: 846

CoffeeScript sourcemaps points to wrong files

I'm building coffee-script project with [email protected] and [email protected], with all default settings.

Then I run a project and got an error somewhere in depths.

And when I'm looking to stacktrace, I see something like this:

module.exports.View.render          jquery.idle-timer.js:24
module.exports.View.afterInitialize jquery.center.js:51
instance.(anonymous function)       jquery.center.js:7
Backbone.View                       jquery-ui.js:1878
View                                jquery.center.js:23

What the madness is this?

It is expected that links on the right points to something like app/some/path/view.coffee, not to jquery plugins (which was not even used in this specific case).

How to fix it?

Upd.

This happens in Chrome and Safari. I've already tried all coffee-script versions starting from 1.3.3, and coffee-script-brunch starting from 1.4.0. All that I have is a bit different line numbers in stacktrace - but they are still wrong.

What is even more interesting, on a test project with three modules all works perfect - stacktrace points to exactly a line which throws an error. On big project all is wrong. I don't understand how could this be.

Upd.2

Well, I've found that sourcemaps are compiled wrong.

When I build same project with same version of all packages on another computer and then just put sourcemaps, compiled there, to my computer - all works perfect.

As I noticed above, I've already tried to reinstall all packages which could be involved here. I even tried to reinstall Node.js, in simple way - brew uninstall node, brew install node. It didn't help.

So what else could be updated/reinstalled/cleaned/etc. to fix this issue?

Upd.3

Well... It seems to be a kind of magic. I've created a pure virtual machine with Ubuntu, cloned project there and build it. In absolutely pure environment.

With same results.

I don't know what the hell is going on, now I suppose that even if I'll reinstall OS, it will not help. Maybe, buying a new computer can solve the problem, I don't know...

Upvotes: 1

Views: 416

Answers (1)

jeron-diovis
jeron-diovis

Reputation: 846

Unexpectedly, but I've found an answer.

The only reason was in source-map package, which is in brunch dependencies.

I've tried only two last versions of brunch: 1.7.13 and 1.7.14. Both of them requires source-map version ~0.1.26. Which is for now resolved to 0.1.34 wherever you install brunch.

And this is a root of evil.

What I've actually did is manual replace 0.1.34 with 0.1.33, directly in global brunch/node_modules folder.

And that's it. After this everything magically fixed, and my sourcemaps point to right lines again.

Don't know WHY it is so - maybe, [email protected] is broken. But this really works.

Upvotes: 2

Related Questions