Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is requirejs trying to load .map?

Tags:

cdn

requirejs

I am trying to load scripts from a CDN (cdnjs to be specific), and in requirejs you have to leave the extension off like so:

require.config({
    baseUrl: '/static/js/',
    paths: {
        underscore: ['//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.1/underscore-min']
    },
    shim: {
        'underscore': {
            exports: '_'
        }
    }
});

But when I do this, the browser tries to load underscore-min.map and not underscore-min.js.

How do I fix this, and also what is a .map?

like image 579
nkcmr Avatar asked Jul 27 '13 13:07

nkcmr


1 Answers

.map files are needed for sourceMap support in the browser. This is the last line from the file you load from the CDN:

 //# sourceMappingURL=underscore-min.map

This line makes your browser to load the .map file.

like image 156
Andreas Köberle Avatar answered Oct 27 '22 22:10

Andreas Köberle