You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing code which I share between a web page and an extension, and I'm using webpack. So this presents a giant problem for me in that I can't import browser from 'webextension-polyfill' in shared code because it tries to do things like poke at chrome on import.
I'm trying to use dynamic imports but that's really a sub-par solution.
I'd like to be able to import webextension-polyfill without it crashing a web page on import.
The polyfill requires a chrome object in order to work as expected. What do you expect to happen when you call import browser from 'webextension-polyfill' from a web page?
I would expect it to not do anything on import that would throw an exception. Perhaps checking typeof(chrome) != 'undefined'. I would expect it to throw an exception if I call stuff on it later, but not during import if chrome is undefined.
I'm writing code which I share between a web page and an extension, and I'm using webpack. So this presents a giant problem for me in that I can't
import browser from 'webextension-polyfill'
in shared code because it tries to do things like poke atchrome
on import.I'm trying to use dynamic imports but that's really a sub-par solution.
I'd like to be able to import webextension-polyfill without it crashing a web page on import.
I get this in Safari: https://user-images.githubusercontent.com/245131/37903693-7a0bee60-3101-11e8-99a3-e5e5d4389cea.png
The text was updated successfully, but these errors were encountered: