How to use webrtc-adapter (adapter.js) shim in Webpack? -
i have commonjs browser application (typescript) use webpack bundle. uses webrtc want use webrtc-adapter package npm. package adapter.js makes working webrtc between firefox & chrome easier.
inside modules want able access modified navigator item. example, can call:
navigator.mediadevices.getusermedia
i can work if require package , use variable somewhere in module so:
var webrtc = require("webrtc-adapter"); // somewhere in module console.log(webrtc.browserdetails);
however, don't need access browserdetails or of exposed items webrtc-adapter, want use shimmed calls on navigator object. i've tried using webpack.provideplugin , externals both still require use object somewhere.
is there way can load shimmed navigator each module without having require , use variable somewhere in modules? know can use external in config , load via separate script tag i'd prefer have webpack bundle together.
have tried requiring this?
require('webrtc-adapter');
Comments
Post a Comment