Skip to content
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-map refresh question #344

Closed
merqlove opened this issue Jul 19, 2016 · 7 comments
Closed

Source-map refresh question #344

merqlove opened this issue Jul 19, 2016 · 7 comments

Comments

@merqlove
Copy link

merqlove commented Jul 19, 2016

How to setup it right for guaranteed source-map refresh?

Currently i have new branch of Rails 4.2 with Sprockets 4.0 beta2.

TL;DR
Repo with reproduce:
https://github.com/merqlove/sprockets4-source-map-bug

Added manifest file with source like this:

// assets/config/manifest.js
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .scss

//= link application.js
//= link application.css

Also i have root coffeescript file:

# assets/javascripts/application.coffee

#= require web/index

And web folder index file:

# assets/javascripts/web/index.coffee
#= require_self
...
#= require_tree ./broadcasts
...
# some code

First time SourceMap processor generates right version of the map.
But, if i did some changes in the content, for example its child file with coffeescript source in ./broadcasts, content of application....js is changing, for example i'm added console('LALALA') but SourceMap not refreshing, always same source-map file with same fingerprint.
4 times i've looks to the end of application....js, and 4 times i found:

//# sourceMappingURL=application.js-64eb1dee0f03a6038c4dd3bd9f77a25f7b5c05095344c19b5800bba7289b443e.map
//# sourceMappingURL=application.js-64eb1dee0f03a6038c4dd3bd9f77a25f7b5c05095344c19b5800bba7289b443e.map
//# sourceMappingURL=application.js-64eb1dee0f03a6038c4dd3bd9f77a25f7b5c05095344c19b5800bba7289b443e.map
//# sourceMappingURL=application.js-64eb1dee0f03a6038c4dd3bd9f77a25f7b5c05095344c19b5800bba7289b443e.map

Same picture also i've seen with master branch of current repo.

@merqlove
Copy link
Author

Seems that something with cache.
Because i see map changes in coffee processor.

@merqlove
Copy link
Author

merqlove commented Jul 19, 2016

Script works well, as it updated, look console.

Map is old

So here screenshot and repo with reproduce:
https://github.com/merqlove/sprockets4-source-map-bug

@Strech
Copy link
Contributor

Strech commented Aug 15, 2016

I will try to debug and fix it (I hope, that I can find a solution or point to the root cause)

@merqlove
Copy link
Author

@Strech
Example, how SourceMap can look out from Webpack:
screenshot 2016-08-15 19 31 42

@Strech
Copy link
Contributor

Strech commented Aug 17, 2016

@merqlove I've succeeded with reproducible failure in tests. Hopefully, I will nail this issue 😲

Strech added a commit to Strech/sprockets that referenced this issue Aug 18, 2016
Closes rails#344

Add processed source file dependencies to the source map.
This asset call `@env['application.js.map']` will add compiled
`application.js` dependencies with all derectives to the
`application.js.map` asset
@schneems
Copy link
Member

Thanks for this repro case, it made verifying the fix way easier. Thank you all for your detailed bug report and for fix.

@merqlove
Copy link
Author

Thanks! Seems it works. Tested on staging project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants