這是我在運行simplenested.coffee
時得到的堆棧跟蹤,其中包含require 'simpleerror.coffee'
。至少在1.6.3
中,使用了兩個文件的sourceMaps。在之間是loadFile
的行。如果事先編譯了任一文件,相關的框架行將引用Javascript代碼。
2011:~/myjs$ coffee simplenested.coffee
ReferenceError: x is not defined
at foo (/.../simpleerror.coffee:4:7)
at Object.<anonymous> (/.../simpleerror.coffee:7:1)
at Object.<anonymous> (/.../simpleerror.coffee:2:1)
at Module._compile (module.js:456:26)
at Object.loadFile (/.../coffee-script/lib/coffee-script/coffee-script.js:182:19)
at Module.load (/.../coffee-script/lib/coffee-script/coffee-script.js:211:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/.../simplenested.coffee:2:8)
at Object.<anonymous> (/.../simplenested.coffee:1:1)
at Module._compile (module.js:456:26)
simplenest.coffee
require 'coffee-script'
nested=require './simpleerror'
simpleerror.coffee
foo =() ->
y = 'testing'
y = x # expect ReferenceError
return y
foo()
恐怕它不會幫助,因爲我沒有將咖啡編譯成js來加載和運行它。我試圖訪問正在運行的咖啡腳本的**當前**源地圖(可能通過可能動態評估的幾個「require」)。無論如何,謝謝 – Artazor
使用當前的'coffeescript',它確實在編譯時,'prepareStackTrace'確實使用了適當的'sourceMap'。 – hpaulj