为从 Coffeescript 编译的多个连接的 javascript 文件生成源映射

Generating source maps for multiple concatenated javascript files compiled from Coffeescript(为从 Coffeescript 编译的多个连接的 javascript 文件生成源映射)

本文介绍了为从 Coffeescript 编译的多个连接的 javascript 文件生成源映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人在这方面取得过成功吗?

Has any one had any success with this?

推荐答案

我认为这或多或少是一个未解决的问题:https://github.com/jashkenas/coffee-script/issues/2779 .最后一个有意义的评论来自一个月前的 jwalton.

I think it's more or less an unsolved problem: https://github.com/jashkenas/coffee-script/issues/2779 . Last meanigingful comment was from jwalton, a month ago.

不过,增加对它的支持似乎不是火箭科学,所以它可能很快就会到来.

Still, it doesn't seem rocket science to add support for it, so it will probably come soon.

Michael Ficarra(CoffeeScript Redux 的创建者)建议使用 https://github.com/michaelficarra/commonjs- 无处不在 .

Michael Ficarra (creator of CoffeeScript Redux) suggested using https://github.com/michaelficarra/commonjs-everywhere .

两个警告:

  • 它仅适用于捆绑 CommonJS 模块.
  • 它使用的是 CoffeeScript Redux,它仍处于测试阶段(尽管看起来工作得很好),并且与原始 CoffeeScript 编译器不是 100% 兼容.

所以这不适用于您特别要求的连接".

So this does not work for what you ask for specifically, "concatenation".

您可能会很幸运:combine-source-map 和/或generate-sourcemap,均出自同一作者.

You might have luck with these: combine-source-map and/or generate-sourcemap, both by same author.

这看起来很简单:https://npmjs.org/package/mapcat.您只需将咖啡编译器生成的各个源映射文件提供给它.

This looks really simple: https://npmjs.org/package/mapcat . You just have to feed it the individual source map files generated by the coffee compiler.

Mariusz Nowak 刚刚发布 webmake-coffee.与 CommonJS Everywhere 一样,它需要将代码组织为 CommonJS 模块.与其他地方的 CommonJS 不同,它使用常规的 CoffeeScript.

Mariusz Nowak has just released webmake-coffee. Like CommonJS Everywhere, it requires code to be organized as CommonJS modules. Unlike CommonJS everywhere, it uses regular CoffeeScript.

Grunt Coffee-Script 插件 似乎也有源映射支持连接文件很长一段时间(两个月),有效地证明我原来的答案是不正确的.

It also seems the Grunt Coffee-Script plugin has had source-map support for concatenated files for quite a while (two months), effectively proving my original answer to be incorrect.

即将推出的 Snockets 2.0 版也将支持它.

The upcoming version 2.0 of Snockets will have support for it too.

这篇关于为从 Coffeescript 编译的多个连接的 javascript 文件生成源映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:为从 Coffeescript 编译的多个连接的 javascript 文件生成源映射

基础教程推荐