Using jQuery Mobile with webpack

Using jQuery Mobile with webpack

I have a cordova mobile app build with jquery-mobile. Instead of importing the js files through script tag I want to using a packager webpack. I have tried to simply do 
var $ = require('jquery-mobile');
but I bump into a bunch of errors. Does anybody know how can I require jquery-mobile using webpack.

I am a complete newbie in using webpack.