Closed aszmyd closed 6 years ago
We cant properly setup global global AdapterJS options like forceSafariPlugin when including library using module bundler (i.e. WebPack).
forceSafariPlugin
Consider this code:
window.AdapterJS = { options: { forceSafariPlugin: true } }; require('adapterjs');
The option is actually not being set because in library you dont explicity try to grab AdapterJS object from Window:
AdapterJS
var AdapterJS = AdapterJS || {};
and bundlers like webpack resolves such runtime require with functions that adds scope to execution and this kind of syntax is not working.
Super simple solution for this is to use this kind of syntax:
var AdapterJS = AdapterJS || window.AdapterJS || {};
Without this change i actually dont know how to override those options in such case.
Pull Request created: #300
We cant properly setup global global AdapterJS options like
forceSafariPlugin
when including library using module bundler (i.e. WebPack).Consider this code:
The option is actually not being set because in library you dont explicity try to grab
AdapterJS
object from Window:and bundlers like webpack resolves such runtime require with functions that adds scope to execution and this kind of syntax is not working.
Super simple solution for this is to use this kind of syntax:
Without this change i actually dont know how to override those options in such case.
Pull Request created: #300