Jump to content

Under what circumstances does phaser request the 'phaser.map' file?


cheesepencil
 Share

Recommended Posts

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

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

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 seen

http://$HOST/js/phaser.min.js is being assigned a //# sourceMappingURL, but already has one

in the console and have ignored it since I started the project.

Link to comment
Share on other sites

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

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...