I am porting a vanilla javascript project to webpack. Previously, a whole bunch of javascript files were imported in <script>
tags. Now I'm putting them all in bundle.js
using webpack.
One issue I have is that previously I had a file "utils.js" with extra Date prototypes and things, e.g.:
Date.prototype.addDays = function(days) {
var dat = new Date(this.valueOf());
dat.setDate(dat.getDate() + days);
return dat;
}
This file defined these things in global scope, so they were available everywhere.
When compiling my project with webpack, how can I achieve a similar thing?