GET *.js.map Error

Hi.
What kind of error is this?

DevTools failed to load source map: Could not load content for https://localhost:8080/modules/babylonjs.materials.min.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

I am editing a project locally (java script) without npm just with referencing to the .min packages which I put in a subfolder.
The project is working fine, but I get these errors on all the modules I load in the browser console.

/modules/babylon.js.map
/modules/babylonjs.materials.min.js.map
/modules/babylonjs.loaders.min.js.map

Surely I am missing something basic.

Thx for an answer,
Best Werner

By default, web browsers will try to load “JavaScript Source Map” files whenever the developer console is opened.

You are not doing anything incorrectly unless you want to be able to debug actual source/line numbers when using the minified versions. In that case, you need to put the javascript source map files in place beside the minified JS files. If you do not care and the errors bug you, then you can also disable JS source map file loading. It’s a setting in the developer console usually titled something like “Enable Source Maps”.

3 Likes

Thank you.
You cheered me up!
Will look into that.
Best. Werner

1 Like

And on a side note, source maps are very helpful for debugging, so i would personally recommend adding them as well :blush:. The app will work well without them, of course

so, looking into that, do I need to create source maps each time by myself?
Is there a pre created sourcemap I can link for the babylon packages?

sry to ask, may be a quick answer.
This is already a bit too deep for me. :wink:

oh, no. we provide sourcemaps to all of our js files. Not sure what the “modules” directory is and where you got the files from, but the .map files should be right where you got the .js files. download them and put them in the same directory.

Again, this is optional and just for debugging purposes. also note that if you serve .map files in production, your js won’t be seen minimized or obfuscated if debugged using the dev tools

right.
Thats the place:

But that leads me to a different question.

We start to understand the TS version and local development using the template (you pointed me to) and NPM.

I am wondering, if there is such a possibility (npm, local dev) but in Javascript and babylon min versions.

The setup I have done is manually, so I created the project tree and downloaded the mins, which is not very convenient.

You don’t have to use typescript. Just reference index.js as the entry instead of index.ts in the template you are using, and it should (emphasis on should) work, if everything is set up correctly. Not sure why you want to use the minified version during development, but you can decide which version to consume in your packer setup.

Okay.
Actually I dont wanna use it in the development, or lets say I dont know if/why/why not etc.
The final result should probably be the minimized version.(?).
I guess we dont understand the concept of the packages, packer setup aso.

So probably we need to learn a bit more first.

There are quite a couple of concepts, which are very different.

This is a bit out of the scope of this forum, but a bundler/packer/nameitasyouwish-er) takes all of your application’s resources and bundles them together to a deliverable resource that can be used (usually) to serve your website. I didn’t read this entire article (and certainly didn’t write it) but maybe this could be a nice intro:

Yes, the final result should be minified for performance reasons. While developing though, you want to be able to debug your application, and that’s only possible when not using a minified version (or when using a sourcemap file that your bundler can generate for you).

I would read about bundlers (webpack is probably the most documented of them all, but there are others!), understand a bit more about web delivery. But that’s more advanced stuff and has technically nothing to do with your babylon.js app. Start with the minified version from the CDN, and when you get to a point that you need to optimize your build take the next steps.

Thanks for the kind words and useful links.
We definitely come from a different direction. So the whole webstuff …
But thats what we expected.

Babylon itself is more easy to understand for us;). So the content itself is a pleasure to develop.

2 Likes

Reading this always makes the entire team happy :slight_smile:

Sorry about the web stuff! but yeah, web dev can seem very easy and turn to overwhelming very quickly.

2 Likes