I have a third party script which is an optimized AMD file that contains a CommonJS wrapper:
// bar.js
define('bar', function(require) {
var foo = require("./foo");
});
define('foo', function () {});
When I try to bundle this file into my own file:
// app.js
define(['bar'], function () {});
r.js doesn't notice that foo is already defined within the bar file, leading to:
>> Error: ENOENT, no such file or directory
>> '/Users/OliverJAsh/Development/frontend/foo.js'
>> In module tree:
>> app
I'm guessing this is because r.js has to perform static analysis of the CommonJS wrapper. What do you recommend to work around this issue?
I have a third party script which is an optimized AMD file that contains a CommonJS wrapper:
When I try to bundle this file into my own file:
r.js doesn't notice that
foois already defined within thebarfile, leading to:I'm guessing this is because r.js has to perform static analysis of the CommonJS wrapper. What do you recommend to work around this issue?