-
Notifications
You must be signed in to change notification settings - Fork 794
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
Source maps aren't working #157
Comments
Still broken, @cannikin. Nobody's on board to investigate, much less fix it. Please do dig in 😁 |
Ohhhh boy! But we're definitely sticking with the source map idea rather than the current (Rails 3/4) behavior of including all JS and CSS files separately while in development? |
Nothing definitive. Reverting to the current behavior is a good option until sourcemap support works as people expect. |
Source maps are on my radar, but i'm playing catchup. See: #124 (comment) for a rundown of where we are right now. Source maps are a pretty big project, it's not like it was done and just has a few edge cases that need polishing. I'm trying to get official time at work to dedicate to source maps, and haven't made much progress there. |
Is it an "easy" matter to revert to the current behavior (individual includes) so in the meantime people running on edge can use the web inspector? Then re-enable source maps in master once they're working properly? Is a release candidate for Rails 5 being talked about at all? If this can't get fixed by that date then it'll have to get reverted, no? |
There's no release of sprockets 4 so there's nothing to revert. Master branch is a WIP. I would recommend using Sprockets 3. |
Oh damn, that worked! I assumed edge
Thanks! |
🚀 |
I tested this app out with my branch #206. Cleared |
Strike that, needed to clear the cache again and it worked. I'm worried that there is so much cache clearing needed. Looks like my branch works? Can you give it a try on your app and report back? |
I think you can automatically clear the cache of you bump the version of On Tue, Dec 29, 2015, 19:03 Richard Schneeman notifications@github.com
|
I added a file to a running sprockets process
When I refreshed the page, the change was in |
I've got no known blockers for source maps. What do you think next steps should be? Merge that branch, cut a pre-release and get people trying it? |
Seems like a great plan 👍 |
@schneems seconded, would love to begin hammering source maps for bugs :) |
in chrome this has been the case for some time - you have to explicitly close and reopen developer tools to get fresh source maps. it looks like they just started to fix it: |
i've been trying to get this to work locally. in
i could do this for the other compressors that generate source maps as well - is that the right approach or should this be a separate processor that runs after all compressors and conditionally adds the links if necessary?
should
|
@schneems ping! Would love to know if you've had the time to work on sprockets recently, and source maps more specifically. |
@vincentwoo have you tried the sprockets 4 betas? |
When trying to use the latest betas of sprockets (I also had to use 6.0.0.beta1 for sass-rails, too), I get the following error when my view tries to render and
|
This is because sprockets can't split the file name any better. I tried to change this, but it was too expensive. Maybe it's possible but I gave up. I'm not a big fan of how sprockets uses URIs to store all data about an asset and then parses that URI, it seems slow but I haven't had any time to look into implementing an alternative. It's also so baked into everything I don't think there's a viable way forward, we're pretty stuck with what we've got.
I've got Sprockets 4 beta working with codetriage.com and source maps. Unfortunately my general knowledge is still pretty limited here, the best way forwards to resolving specific problems is to open new issues and to attach example apps that repro the problems. |
Source maps working fine in development for me. Couldn't get production to generate maps. I then tried @modosc method with # add link to the source map
links = Set.new(input[:metadata][:links])
map_uri = input[:environment].build_asset_uri(
input[:filename],
type: 'application/js-sourcemap+json'
)
links << map_uri
{ data: js, map: map, links: links } That generates the maps but doesn't like the application.js to them. So kind of stuck now. The hash name doesn't follow the actual naming of the file otherwise I would just add it manually. |
If you have example apps that show source maps not working correctly can you open separate tickets and link example apps? |
I don't know if this is relevant, but I was just trying Sprockets 4 beta 2 with Rails 4. I set up a manifest.js and my app appears to work, and while I can access http://localhost:3000/assets/application.js.map , my actual application.js does not have a sourceMappingUrl comment anywhere. Is there something I need to do to enable it in Rails 4? Unfortunately I can't link the source because it's for work but I just waneted to make sure I wasn't missing something. Thanks for working on this! Edit: Seems like I was able to get it to kind of work by adding an explicit //# sourceMappingURL=/assets/application.js.map to my application.js. Looking at SourceMapCommentProcessor, it seems like it doesn't get run automatically except in debug mode, but even in debug mode it didn't seem to work for me. But the line numbers seem to be off still... not sure what's going on there yet. Will try to reproduce and submit an example app if I can! |
You shouldn't have to manually add a source map comment. It should just work "TM". Please, if you have example apps that show source maps not working correctly open separate tickets and link an example app. |
@ibrahima I am also experiencing the line numbers being off. They are currently off by 2 lines exactly across the entire source. I'm working on trying to identify why this is but thought I would ping you to see if you happened to identify anything around this. |
Please try out master, it has a few new fixes. Otherwise if anyone comes across source maps not working please open up a new issue. I need to be able to gauge how stable master is. I want to work on releasing an RC and eventually 4.0.0 we can't do that without pretty decent source map support. I appreciate all your feedback, you've all helped tremendously. Please give it another go with master and let me know if you've got more issues (by opening a new issue). |
@schneems, it's super hard to test master because i have no idea which gems need to be updated. is there a guide on how to take a rails 4.2 project to master sprockets without everything mysteriously exploding? ill try to make a repro case but its hard to tell where to even start |
If you're already running the beta (you have to to get source maps, it's pretty easy to upgrade, put this in your gemfile and
Master is only a few commits ahead of the 4.0 beta |
@vincentwoo - as a note, if you find your sourcemaps off by a few lines, I would check #388 |
@danshultz i'm finding that with some files in my bundle the source maps appear to not even be able to find the correct file. i'll file a separate issue |
#157 no source maps upgrading to master should supposedly fix source maps rails/sprockets#157
Source maps don't appear to be working when creating a new edge rails app.
Creating a new rails app, adding a basic / empty controller, action, view, and then adding a simple coffeescript file with a debugger statement in it yields this in the chrome inspector...
Digging into the application.js file shows that the source mapping url is there, but the map doesn't seem to be served...
Example app: https://github.com/relappi/source-maps-testapp
The text was updated successfully, but these errors were encountered: