Closed krnlde closed 9 years ago
Hi @krnlde, could it be that you're configuring RequireJS with a path rather than a package? Here are the instructions for configuring when.js in an AMD environment. If you're using paths
, switch to a packages
config for when.js and that should do it. If you're already using packages
and seeing this problem, then we'll need to dig a bit deeper :)
Darn, I feel so dumb right now. I indeed included it as a path. This line solved the problem entirely:
requirejs.config({
packages: [
{ name: 'when', location: '/path/to/when', main: 'when' }
]
});
This solution is hard to find. I searched for a solution on google for about one hour now. Searched for "AMD and when.js" or "require.js when.js" but didn't get this result you provided...
Thanks man and sorry for wasting your time.
@krnlde No worries at all. Glad that helped.
This solution is hard to find
Hmmm, that's a bummer, and a problem. I wonder how we can make that more visible to google.
Maybe adding a few more introductional lines containing the keywords AMD, require.js, require, define, when.js
right before the instruction itself could help. At least these are the keywords I used to get some help. And adding the requirejs instructions to the README.md
would also be helpful, since this was the page I started with checking for the keyword require
.
I installed when.js via bower. Because of when's new commonJS
require();
, which was introduced in v3, I am unable to load "when" via require.js.The relative paths
./lib/...
, like invar timed = require('./lib/decorators/timed');
, are not resolved correctly and the browser fails with a path like thisproject_root/lib/...
instead ofproject_root/bower_components/when/lib/...
.My approach right now is to fall back to v2 which integrates nicely with require.js
Any suggestions on this?