14

I use webpack as a module bundler

I have map files enabled

In chrome my original script files come from a special webpack resource enter image description here

I'm not too sure what causes it but sometimes an old version of a script gets cached. The actual new code is still updating correctly but the version referenced by the map is out of date. This means line numbers don't match anymore and I cant see any code changes (eg super annoying).

It seems to eventually just fix itself but makes me sad in the meantime.

Has anyone else had similar issues/have any ideas of how to sort it out?

It seems to be isolated to chrome (if I go to another browser the correct version is loaded)

I have tried:

  • Deleting the map file and regening it
  • Empty cache and hard reload
  • Manually navigating to the file in chrome (correct version is returned but it remains out of date when refed by map file)
Damjan Pavlica
  • 31,277
  • 10
  • 71
  • 76
undefined
  • 33,537
  • 22
  • 129
  • 198
  • Yeah, I had this issue too. Standart cache cleaning doesn't solve it. The only solution I've found is to clear the cache this way: Go to Network tab in devtools, press right button and click "clear browser cache". – Kreozot Sep 16 '15 at 07:24

1 Answers1

4

I worked out that this was caused by the actual map file being cached.

If you open the map file in a new tab and hard reload it, the source is all updated correctly

Its probably a bug in chrome that this is not reloaded with the dev tools disable cache setting or the pages hard reload.

undefined
  • 33,537
  • 22
  • 129
  • 198
  • Besides manually refreshing the page to see your updated source map, did you figure out a solution? Were you using hot reloading (hot module replacement)? I'm having the problem that you describe with hot-reloading (the code itself is injected into the page but the source maps are out-of-date). It happens with both "source-map" (where a separate source map file is generated) and "eval-source-map" (where the source map is embedded into the source file). – Jason Frank Mar 18 '16 at 14:43
  • @JasonFrank sadly the only way I've solved it was to manually refresh the map file. I wasn't using hot loading at the time but its the same problem. I'm not sure if its limited to chrome or to webkit. If its a real pain it might not be as bad in another browser. – undefined Mar 18 '16 at 21:01
  • this is still a nightmare in chrome – SuperUberDuper May 05 '16 at 11:07
  • the only other way to solve this problem is by reinstalling Chrome – ferroariel Oct 07 '16 at 23:30