-
Notifications
You must be signed in to change notification settings - Fork 673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate source maps for bundled files #397
Comments
I'm confused how is this different than what is already available? Would this provide multi-stage source maps? So my uglified and concatenated r.js generated file could source map all the way back to my coffeescript? |
@dbashford that is the hope. This ticket is for going from separate JS files to bundled files. Uglify can take it from bundled to minified. What is then needed is a way for transpiler plugins to participate, so .coffee to separate JS files. That will likely be worked out at least in part in this ticket for the coffeescript plugin: |
+1 |
This work was done in a branch, and did a local merge without a merge commit, finished up in bdd34e1 |
This is awesome. Have been looking for this for a while. +100 |
I just updated and this is working brilliantly. This is a huge improvement for debugging production web sites. I was wondering: do you know if its possible to make this work for an additional level of indirection? Our source files are CoffeeScript and then they are compiled to JavaScript before being bundled up via requirejs. The current support allows debugging back to the compiled JavaScript files but not the CoffeeScript source files. This seems somewhat related to the require-cs issue called out above. I would guess that either uglifyjs would have to support this feature. In case anyone is wondering why we don't use the require-cs plug-in instead of this build process, it's because it breaks our content security policy and we found that compilation times in Firefox and IE were very slow (which dramatically slowed down page load times as the amount of code we wrote increased). |
Just updated Mimosa with the latest requirejs and this works like a charm. Re: the comment above Uglify supports being passed a source map as input, which makes it easy to go from coffee to js to mangled js while preserving the original map back to the coffee source. But I'm not sure if it supports being passed N maps for N files that are being bundled together. It may. Not something I've looked into, but was on my short term roadmap to dig through uglify to understand how it works. |
@derekcicerone I am hoping to wire up that leg of the source map journey, coffee-script to JS. I was planning to do that as part of requirejs/require-cs#42, and I want it to work even if that plugin does not generate the source map. A sketch: If there is a "filename.js.map" file, use that as the start map for the source map chain. Hopefully the cs translation would generate that file. Ideally that map uses sourcesContent as it allows the "single file optimization" case better. |
If you have I'd be happy to do some beta testing of this feature :) |
For concatenated/bundled build layers, support source map generation so that a source map-enabled browser could allow debugging of the combined file as separate files for each module.
This should work without minifying, so if optimize: 'none' is in play. Then, also connect that source map bundle with the one uglifyjs2 uses when minifying.
The text was updated successfully, but these errors were encountered: