Skip to content

Instantly share code, notes, and snippets.

@iammerrick
Created August 21, 2013 22:10
Show Gist options
  • Save iammerrick/6300916 to your computer and use it in GitHub Desktop.
Save iammerrick/6300916 to your computer and use it in GitHub Desktop.
define(function(require) {
return {
child: require('./relative')
};
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="bower_components/requirejs/require.js"></script>
<script type="text/javascript">
require(['/some/module/depth.js'], function(depth) {
});
</script>
</head>
<body>
</body>
</html>

When I use an absolute url to require a module its loading strategy is propagated and the .js is not added to the module relative and a 404 occurs. I would expect the resolution rules to stop at the initial module and not cascade further, this means you cannot use relative URLs within a module required in an absolute sense.

GET http://localhost:3000/some/module/relative 404 (Not Found) require.js:1880 Uncaught Error: Script error for: /some/module/./relative http://requirejs.org/docs/errors.html#scripterror

define(function() {
return { hello: 'World!' };
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment