CommonJS Scan Shouldn't Occur if dependencies [] is set
jakobo opened this issue · 3 comments
jakobo commented
Sample code:
// program.js
define(['foo'], function(foo) {
equal(foo.name, 'foo', 'foo.name was set properly');
});
// foo.js
define('foo', [], function() {
var fooName = 'foo';
// the bar module should not be loaded per the AMD spec
try {
fooName = require('bar').name;
}
catch(e) {}
return {
name: fooName
};
});
// bar.js
define('bar', function() {
return {
name: 'bar'
};
});
jakobo commented
Possible places we could fix:
- RequireContext - change the way define() works?
- Analyzer / TreeDownloader? - argument to not scan dependencies?
jakobo commented
Fixed by @apmadhani