Webpack global

关于 global,各种情况下的实现,来源 "version": "3.11.0"/builtin 目录
更新于: 2023-10-23 21:18:35
var g;
// This works in non-strict mode
g = (function() {
  return this;
})();
try {
  // This works if eval is allowed (see CSP)
  g = g || Function("return this")() || (1, eval)("this");
} catch (e) {
  // This works if the window reference is available
  if (typeof window === "object")
    g = window;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module.exports = g;