Vikrant
Vikrant

Reputation: 283

Why does chrome try to load the unminified version of jQuery when including the minified version?

The script tag has a src attribute of jquery-2.0.3.min.js, but Chrome somehow requests for jquery-2.0.3.js as well. I am not able to understand as to why this happens.

Is there something wrong with jquery-2.0.3 version?

Here is the snapshot of Chrome developer tools debugging:

Chrome Developer Tools screenshot

Upvotes: 2

Views: 792

Answers (2)

Giulio Bonanome
Giulio Bonanome

Reputation: 366

As pointed out by Boaz that seems your Chrome detect and use source maps.

To avoid loading source maps, from Chrome Dev Tools Settings > General deselect "Enable JS source maps" option.

See Chrome DevTools>Debugging JavaScript

Upvotes: 0

Boaz
Boaz

Reputation: 20230

Problem

From the screenshot it seems you're including jQuery's source map file (jquery-2.0.3.min.map).

This file allows Chrome to more clearly debug the minified version of jQuery (jquery-2.0.3.min.js).

However, the source map file also tells Chrome to load the unminified version of jQuery (jquery-2.0.3.js), and since it does not exist locally you see the failed request.

Solution

Either do not include the source map file altogether, or add the unminified version of jQuery to the local directory as well.

Read more about jQuery's source maps.

Upvotes: 1

Related Questions