downforacross / puzjs

ISC License
3 stars 2 forks source link

Issues in Chrome Extension context #5

Open multimeric opened 4 years ago

multimeric commented 4 years ago

You're currently compiling this as a UMD (which is great), however the gulp UMD seems to output this:

;(function(root, factory) {
  if (typeof define === 'function' && define.amd) {
    define([], factory);
  } else if (typeof exports === 'object') {
    module.exports = factory();
  } else {
    root.Puz = factory();
  }
}(this, function() {
// Code
}));

I suppose this works fine in the browser, since this is bound to window, but Chrome extensions don't seem to have a value for this, causing this entire module to fail to load.

Happening with puzjs@1.0.2.

multimeric commented 4 years ago

I think the solution relates to this: https://stackoverflow.com/a/34983495/2148718