Answer the question
In order to leave comments, you need to log in
How to correctly specify the paths in the config?
// project structure:
/
src/
js/
main.js
index.html
test.js
requirejs.config({
baseUrl: "/src/js/",
paths: {
test: "/test.js"
}
});
var paths = ['test'];
var factory = function(Test){
console.log(Test);
};
require(paths, factory);
Error: Script error for: test
requirejs.org/docs/errors.html#scripterror
Answer the question
In order to leave comments, you need to log in
I don't think the leading slash is needed. Either src/js
and test.js
or ./src/js
and ./test.js
. Unless, of course, requirejs has standard globs, and not some invention of its own.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question