Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Wrong line number? #7

Open
jiyinyiyong opened this Issue · 5 comments

4 participants

@jiyinyiyong

It looks strange on my browser, so I wrote a test file:

index.html:

<script src="build.js"></script>

main.coffee:

console.log "1"
console.log "2"
console.log "3"
console.log "4"

Build with:

browserify -t coffeeify main.coffee -d > build.js

Result(copied from console, the spaces between are strange...):

1 main.coffee:1
2 main.coffee:1
3 main.coffee:2
4 main.coffee:3

build.js:

;(function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0](function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i})({1:[function(require,module,exports){
(function() {
  console.log("1");

  console.log("2");

  console.log("3");

  console.log("4");

}).call(this);


},{}]},{},[1])
//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuZXJhdGVkLmpzIiwic291cmNlcyI6WyIvb3B0L3Mvc25vd2ZsYWtlL3Rlc3QvbWFpbi5jb2ZmZWUiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQTtDQUFBLENBQUEsQ0FBQSxJQUFPOztDQUFQLENBQ0EsQ0FBQSxJQUFPOztDQURQLENBRUEsQ0FBQSxJQUFPOztDQUZQLENBR0EsQ0FBQSxJQUFPO0NBSFAiLCJzb3VyY2VzQ29udGVudCI6WyJjb25zb2xlLmxvZyBcIjFcIlxuY29uc29sZS5sb2cgXCIyXCJcbmNvbnNvbGUubG9nIFwiM1wiXG5jb25zb2xlLmxvZyBcIjRcIiJdfQ==
;

And I change main.coffee to:

# empty line

console.log "1"
console.log "2"
console.log "3"
console.log "4"

And Result:

1 main.coffee:3
2 main.coffee:3
3 main.coffee:4
4 main.coffee:5

build.js

;(function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0](function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i})({1:[function(require,module,exports){
(function() {
  console.log("1");

  console.log("2");

  console.log("3");

  console.log("4");

}).call(this);


},{}]},{},[1])
//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuZXJhdGVkLmpzIiwic291cmNlcyI6WyIvb3B0L3Mvc25vd2ZsYWtlL3Rlc3QvbWFpbi5jb2ZmZWUiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFFQTtDQUFBLENBQUEsQ0FBQSxJQUFPOztDQUFQLENBQ0EsQ0FBQSxJQUFPOztDQURQLENBRUEsQ0FBQSxJQUFPOztDQUZQLENBR0EsQ0FBQSxJQUFPO0NBSFAiLCJzb3VyY2VzQ29udGVudCI6WyIjIGVtcHR5IGxpbmVcblxuY29uc29sZS5sb2cgXCIxXCJcbmNvbnNvbGUubG9nIFwiMlwiXG5jb25zb2xlLmxvZyBcIjNcIlxuY29uc29sZS5sb2cgXCI0XCIiXX0=
;

My environment:

➤➤ uname -a
Linux laptop 3.8.4-1-ARCH #1 SMP PREEMPT Wed Mar 20 22:10:25 CET 2013 x86_64 GNU/Linux
➤➤ node -v
v0.10.2
➤➤ npm -v
1.2.15
➤➤ npm list coffeeify
npm WARN package.json snowflake@0.0.1 No README.md file found!
snowflake@0.0.1 /opt/s/snowflake
└── coffeeify@0.3.0  extraneous

npm ERR! extraneous: coffeeify@0.3.0 /opt/s/snowflake/node_modules/coffeeify
npm ERR! not ok code 0
➤➤ npm list -g browserify
/usr/lib
└── browserify@2.10.2 
@lhagan

Same issue here -- mapped lines are off by one.

@iirvine

This is an issue with inline source maps in coffeescript 1.6.2 jashkenas/coffeescript#2861

@jiyinyiyong jiyinyiyong referenced this issue in coffee-js/languages
Closed

Browserify + coffeeify 的前端调试方案 #55

@jiyinyiyong

@iirvine Line numbers appear to be right after I git cloned the lastest version from Github.
But when I try to add break ponits in Chrome, some of break points are moved to other files.
I don't know how to git a demonstration here. Have you come across this problem?

@timaschew

@jiyinyiyong can confirm it, you can see it here:
http://cl.ly/ajd6
Video

Chrome 42

So is this still a coffee-script issue or a coffeeify?

@timaschew timaschew referenced this issue in jashkenas/coffeescript
Open

Inline sourcemaps line number mismatching #2861

@timaschew

I think this happens for last lines within a function (implicit returns)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.