Repository navigation
Source map support - #50
Conversation
|
I will leave it to @guybedford to comment more, but my first thought is that source map support should avoid using inline data: URLs for the full source map -- it makes the files very large, and hurts download speeds. I prefer to just have a pointer to the sourcemap file, as then that data is not downloaded to the browser unless debugging is actually desired. |
|
To avoid using inline data you have to generate source map, save them somewhere - too many steps to make it works. With inline data everything work out of the box.
I think this is very bad way to deploy "develop code" to production. Better way is to use r.js, then deploy results minified and with no source maps. |
|
Now that r.js supports generating source maps from minified, bundled code all the way back to non-minified, separate JS files, it seems useful to figure out how to do from separate JS files back to coffeescript files. In other words, the steps to save the map files are already there for separate files, and it gives people a way to debug their minified code. That seems to be a larger win than something that would only make sense before minifying, but I leave it to @guybedford. |
|
In development, this patch makes a lot of sense - require-cs doesn't have filesystem access so it has no choice but to put the source map directly into the code to be evaled, and afaik the only way to do that given the current sourceMappingURL scheme is via a data-uri. So this patch is the right solution for development given the constraints of being in the browser. I think that using require-cs in production (at all) is the wrong move and will continue to cause problems because of its lack of filesystem access. Deployments made to production really ought to be using r.js, in which case it makes the most sense to exclude using require-cs entirely. The real kicker is patching r.js to accept pre-existing source maps, much like uglify2 accepts source maps. Then we could pass 3 levels of source maps through(!) all the way to production:
|
Conflicts: cs.js
|
If I'm not mistaken, there are 2 missing pieces at the moment:
|
I have to add other base64 implementation, because i had problems with "btoa" function and unicode.