gpt4 book ai didi

node.js - coffeescript sourcemap 未在 chrome 中加载

转载 作者:IT老高 更新时间:2023-10-28 23:06:26 25 4
gpt4 key购买 nike

当我调用时,我可以将咖啡文件编译为与 .coffee/.js 文件位于同一目录中的 .map 文件

coffee --nodejs --debug-brk app.coffee

并启动 Node 检查器。应用程序文件的 js 版本在 chrome 中加载。我错过了什么??

这就是 chrome 为 three.coffee 文件显示的内容 ..

(function (exports, require, module, __filename, __dirname) { // Generated by CoffeeScript 1.6.2
(function() {
app.get('/three', function(req, res) {
debugger; return res.send('three/teedde');
});

}).call(this);

/*
//@ sourceMappingURL=three.map
*/

});

谢谢

最佳答案

您是在询问 Node 检查器,因为您说您正在启动它?您的问题似乎是在询问 Chrome 开发工具。请澄清。

npm (0.2.0beta4) 中的node-inspector 当前版本不支持source maps。

即使 issue已关闭,我在 github 上找不到任何可以启用此功能的内容(例如,请参阅 https://github.com/dannycoates/node-inspector/blob/update-ui/lib/session2.js#L123-L131 ,scriptParsed 事件没有 sourceMapURL 参数)。

node-inspector 已被一位新开发人员接管,根据评论(由 Vitaliy Lebedev 撰写),最新版本确实支持源映射。


如果您询问 Chrome 开发工具 - they support source maps .

在 js 文件的最后一行尝试“//@ sourceMappingURL=three.map”。

还要确保您的 express 应用实际上正在提供调试器所需的 .map 和 .coffee 文件(通过在浏览器中输入 url+文件名进行检查)。

关于node.js - coffeescript sourcemap 未在 chrome 中加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15801143/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com