Generating source maps for multiple concatenated javascript files compiled from Coffeescript

前端 未结 4 1389
逝去的感伤
逝去的感伤 2020-12-14 03:21

Has any one had any success with this?

4条回答
  •  一生所求
    2020-12-14 03:56

    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 (creator of CoffeeScript Redux) suggested using https://github.com/michaelficarra/commonjs-everywhere .

    Two caveats:

    • It only works for bundling CommonJS modules.
    • It uses CoffeeScript Redux, which is still in beta (although working quite well it seems), and not 100% compatible with original CoffeeScript compiler.

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

    Added April 14

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

    Added April 26

    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.

    Added May 16

    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.

    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.

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

提交回复
热议问题