Using requireJS, I am trying to specify a path for my data-main that is different from the baseUrl. It seems that requireJS is ignoring whatever I type before the file name, and always look for the file in the baseUrl folder.
I have the following folder structure :
index.html
scripts/
lib/
require.js
test/
main2.js
config.js
Contents of index.html :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Test</title>
<script data-main="test/main2" src="scripts/lib/require.js"></script>
<script src="scripts/config.js"></script>
</head>
<body></body>
</html>
Contents of config.js :
requirejs.config({
baseUrl: "scripts"
});
And I am getting a 404 error for : GET [...]/scripts/main2.js , even though it should be looking for [...]/scripts/test/main2.js. If I remove the config.js file and use data-main="scripts/test/main2" it works, but I would like to be able to specify a baseUrl for my project.
Any ideas ?
Edit : following the answer by Waxen :
- Even if I use "scripts/test/main2", "/scripts/test/main2", or "whateverIWant/main2" in my data-main, it oddly always looks for "scripts/main2.js"
Note that I am using requirejs 2.1.8