cheesepencil Posted August 10, 2014 Share Posted August 10, 2014 I'm trying to refactor some of the code on my multiplayer dungeon game (working version here). Since I started making changes, the page makes requests to /js/phaser.map (I have phaser.min.js inside /js/), a file that doesn't exist. Phaser didn't do this before I started making changes. Now the game page requests /js/phaser.map at least a dozen times when the client initializes phaser, and about six times whenever the player pushes a directional control. Putting an empty file named phaser.map in /js/ stops confusing my server with the requests, but it affects performance... what is this file for, and why does phaser need it? What could I have possibly changed that would require phaser to request this file when it didn't need it before? I think all I did was move some unrelated jquery DOM manipulation code to a separate file. Thanks! Link to comment Share on other sites More sharing options...
lewster32 Posted August 10, 2014 Share Posted August 10, 2014 The map file is a file which Chrome (and possibly other browsers) use to 'unminify' minified JavaScript files. When you use phaser.min.js, the browser will try to look for a file with the same name, but .map instead of .js, which it can use to give you much better debug output (i.e. no 'error on column 99322 of line 1' stuff). I've no idea why your page is requesting it this many times though; it should only request it once when phaser.min.js loads. Link to comment Share on other sites More sharing options...
cheesepencil Posted August 10, 2014 Author Share Posted August 10, 2014 All right, since I don't plan on debugging the phaser library, but only my own game client code, is it safe to remove the sourcemap snippet at the bottom of phaser.min.js? I'm developing primarily on firefox and since the beginning I've always seenhttp://$HOST/js/phaser.min.js is being assigned a //# sourceMappingURL, but already has onein the console and have ignored it since I started the project. Link to comment Share on other sites More sharing options...
cheesepencil Posted August 10, 2014 Author Share Posted August 10, 2014 To answer my own question, no... it still makes the request. Only twice instead of dozens, but I still get the same performance degradation I get when I use the empty phaser.map file. I'll roll back for now and try to see what I changed that started this mess (previously it made no requests for phaser.map at all, which is what I want). Thanks for you help. Link to comment Share on other sites More sharing options...
cheesepencil Posted August 10, 2014 Author Share Posted August 10, 2014 And now I can't replicate the behavior and it does not make the request with or without dev tools open (this stackexchange thread implies that browsers should not request sourcemaps unless using the debug tools) so I'm going to chalk it up to firefox's dev tools being wacky. Thanks again. Link to comment Share on other sites More sharing options...
rich Posted August 10, 2014 Share Posted August 10, 2014 Source maps aren't requested unless dev tools are open, so end users never see them. I can't imagine why it would have any kind of performance impact though, probably just Firefox being arse. If you need it, the Phaser Source map can be found in the build folder in the repo. Link to comment Share on other sites More sharing options...
cheesepencil Posted August 10, 2014 Author Share Posted August 10, 2014 Thanks rich, I tried using the map from the repos before I tried the empty file. In the end, it was firefox being arse. After closing the original tab and opening the game client in a new tab it stopped requesting the map. Link to comment Share on other sites More sharing options...
Recommended Posts