(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(factory);
} else if (typeof exports === 'object') {
// A reference to the require function is made here
module.exports = factory(require, exports, module);
} else {
root.Tether = factory();
}
}(this, function(require, exports, module) {
You can see that on line 7 require is passed to a function, but it is not used as a top-level function call. According to #11, require() is only resolved when used in the global namespace. It seems that the solution used there does not meet all cases.
This means that I get an exception saying Uncaught ReferenceError: require is not defined(…).
It looks like adding the line:
var require = require;
to the beginning of the file side-steps this issue.
I've discovered that in HubSpot/tether's "compiled" .js file, there is an expression which evades Commoner's handling of require.
https://github.com/HubSpot/tether/blob/master/dist/js/tether.js#L7
You can see that on line 7
require
is passed to a function, but it is not used as a top-level function call. According to #11,require()
is only resolved when used in the global namespace. It seems that the solution used there does not meet all cases.This means that I get an exception saying
Uncaught ReferenceError: require is not defined(…)
.It looks like adding the line:
to the beginning of the file side-steps this issue.