rstacruz / nprogress

For slim progress bars like on YouTube, Medium, etc
http://ricostacruz.com/nprogress
MIT License
26.04k stars 1.81k forks source link

"Uncaught Object" error in RequireJS with NProgress 1.3; 1.2 works fine #85

Open SebastianMetzger opened 10 years ago

SebastianMetzger commented 10 years ago

There seems to be some kind of conflict between the latest NProgress and requireJS. After including NProgress 1.3 my initial require(..:) call creates a "Uncaught Object" error.

Have not looked into it any deeper.

Downgrading to 1.2 fixed the problem.

rstacruz commented 10 years ago

If anyone can help debug this issue, it'd be very well appreciated.

rstacruz commented 10 years ago

Okay, I've edited the module loader block to use umd.js conventions. Let me know if it works for you.

4aa6518f

You'll have to fetch the latest master from GitHub on this one — I'll release it if you guys can confirm that it works for you too.

SebastianMetzger commented 10 years ago

I tried it with latest master and the initial problem was the same.

I have to say additionally, that I do not use NProgress with require.js directly. There seems to be some global collision problem with the two libraries.

This is enough to trigger the error:

<!DOCTYPE html>
<html>
<head>
  <!-- NOT WORKING -->
  <script type="text/javascript" src="bower_components/requirejs/require.js"></script>
  <script type="text/javascript" src="js/nprogress/nprogress.js"></script>
</head>
<body>
</body>
</html>

I found out however, that simply reversing the script tag order solves this:

<!DOCTYPE html>
<html>
<head>
   <!-- WORKING -->
   <script type="text/javascript" src="js/nprogress/nprogress.js"></script>
  <script type="text/javascript" src="bower_components/requirejs/require.js"></script>
 </head>
<body>
</body>
</html>
Dreampie commented 9 years ago

if you include nprogress in this way,not need requirejs I test in 0.1.3 and 0.1.6,all work not fine but 0.1.2 work in requirejs,its ok