I am using webpack in my web application for bundling client side code :
In a new.js file which is the main file inside which i want to bundle everything :
I am loading jquery like :
var $ = require(jquery)
installed it via npm install jquery
also in new.js
i am including files like
var util = require(util.js)
And inside util.js i am using $ directly without importing the jquery
On loading my web application its throwing an error in console :
new.js:512Uncaught ReferenceError: $ is not defined
This is happening because $ is only available directly under new.js and util.js is not declaring jquery which i dont want also as otherwise jquery will get bundled twice.
How do i make $ available to all the libraries i am importing later in the js file... ?