Uncaught TypeError: Cannot read property 'appendChild' of null, Ionic App + Webpack+ Viewport Resizer

I’m trying to view Ionic App in Apple iPhone 5 size by using viewport resizer. It worked nicely before I compressed Ionic library files with webpack. But after compressing when I tried to use viewport I’m getting an error like

Uncaught TypeError: Cannot read property ‘appendChild’ of null ionic.bundle.js:42368

in chrome and getting a blank page. The code area where the error occurred is

var el = jqLite('<div class="backdrop">');
var backdropHolds = 0;
 $document[0].body.appendChild(el[0]);

I think the document body changes when the resizer window appears and then $document is picking a wrong window.

Is there any way to overcome this problem so that I can user viewport resizer for Ionic App? Thanks in advance.