Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RequireJS adding '.map' to javascripts rather than '.js' suddenly

I had this working perfectly fine until just today when suddenly all of my js files being loaded via requirejs cannot be found and its because requirejs decided to give each a '.map' file extension rather than the '.js'

I added the '.js' to the paths just to see and then requirejs still failed because it pointed to 'jquery.min.js.js'

I'm baffled how this would suddenly change for no reason at all. Does anyone have any ideas?

require.config
  baseUrl: 'javascripts'
  paths:
    jquery: 'vendor/jquery-1.10.2.min'
    underscore: 'vendor/underscore.min'
    backbone: 'vendor/backbone.min'
  shim:
    underscore:
      exports: '_'
    backbone:
      deps: ["underscore", "jquery"]
      exports: "Backbone"

require [
  'jquery',
  'underscore',
  'backbone'#,
 ], ($, _, Backbone) ->
   $('body').prepend "<div class='marking-up-header'></div>"

Again this was working just fine the last time I worked on this and coming back to it today it was screwed up.enter image description here

Ok, so I took out require.js altogether and now I'm getting the same missing errors with the '.map' still. I opened it up in safari (I was using chrome) and I'm not getting these errors at all. Is Chrome having a stroke? does anyone have any idea?

Thanks.

like image 364
Sparkmasterflex Avatar asked Aug 23 '13 00:08

Sparkmasterflex


2 Answers

As @alexanderb noted, this is happening because of the recent support for source maps in Chrome. To prevent this from happening (if you are not interested in using source maps for minified files), go to the Dev Tools settings panel and uncheck "Enable source maps" under the "Sources" section. Note however, that this turns off source-map functionality for all minified files that have specified a source map using // @ sourceMappingURL=jquery-1.10.2.min.map. No need to edit any files.

like image 50
stavarotti Avatar answered Sep 24 '22 20:09

stavarotti


That's probably happening because of your referring minified files.

Typically you always use un-compressed sources, then you optimise the code with r.js during deployment, so all referred libraries are got minified anyway.

Try to change from the path section and see if issue still appears.

like image 38
Alexander Beletsky Avatar answered Sep 21 '22 20:09

Alexander Beletsky