hyude

[Ask] Error Get phaser.Map

Recommended Posts

Hello, 

 

I am currently learning how to use phaserJS, I am familiar with game development process, and I create HTML5 games before.

 

Upon trying tutorial from Phaser and HelloPhaser, I tried it out on my localhost (with Apache server ON). It works, but on google chrome, the console shows an error "404 File Not Found" while trying to access phaser.map file.

 

Granted, there is no phaser.map file, and only a single minifed phaser file.

 

What confuses me is, why should it ask for phaser.map? Is the error normal (expected),

 

Please enlighten me? Thank you.

 

Share this post


Link to post
Share on other sites

This is normal - Chrome and some other browsers can now optionally download a .map file when your developer console is open, which allows you to more easily debug a minified JavaScript file. If it isn't present you'll get a 404 error but the program will work as normal still. Also, normal users not using developer tools won't send this request and so it won't be a problem. For development you should really be using the non-minified version of Phaser just so this step doesn't have to be taken.

Share this post


Link to post
Share on other sites

Thank you for your response. So I should use the full source version during development, and then switch on the minified during release?

 

However, in tutorial, they use minified version, thus only include 1 file in index.html.

 

If I use full source, how do I include the whole file?

Share this post


Link to post
Share on other sites

If you don't plan on using the map to debug, you can prevent this behavior by removing the following comment from the minifed source:

 

//@ sourceMappingURL=phaser.map

 

Actually, you should remove that line from production code as it will prevent a totally unnecessary http get call (not that is it expensive, however).

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.