Download timeout for modules with requirejs

I use requirejs to load some libraries and dependencies.

When I just load jQuery, it works fine:

main.js

require.config({
  shim: {
    jquery: {
      exports: '$'
    }
  },
  paths: {
    jquery: 'vendor/jquery'
  }
});

require([
  'vendor/jquery',
  'app/init'
]);

application /init.js

define(
  ['jquery'],
  function ($) {
    $(document).ready(function () {
      console.log('domready');
    })
  }
)

But when I try to add underline, in the network pane the file is loaded correctly, but in the console I get

Missed error: load timeout for modules: underscore

What's happening? I also tried waitSeconds: 200 parameters inside require.config without any success.

Below is the final (broken) code as a link:

main.js

require.config({
  shim: {
    jquery: {
      exports: '$'
    },
    underscore: {
      exports: '_'
    }
  },
  paths: {
    jquery: 'vendor/jquery',
    underscore: 'vendor/underscore',
  }
})

require([
  'vendor/jquery',
  'vendor/underscore',
  'app/init'
])

application /init.js

define(
  ['jquery', 'underscore'],
  function ($, _) {
    $(document).ready(function () {
      console.log('domready');
    })
  }
)
+4
source share
1 answer

define require "vendor/<name of module>", "<name of module>". . , , "<name of module>" require define. jQuery Underscore "jquery" "underscore", "vendor/.... , shim.

require :

require(['app/init']);

jQuery Underscore. , app/init.js - define.

( , jQuery , jQuery , AMD define. , .)

+11

All Articles