I'm using Fullcalendar & Moment.js to build a simple interactive calendar using JSON data. I'm using Webpack 2 to bundle my JS into one file. Below is a simplified version of my webpack.config.js
file (the full thing is loading in much more than this).
var webpack = require('webpack');
var bower_dir = __dirname + '/library/bower_components';
var config = {
resolve: {
alias: {
jquery: bower_dir + '/jquery/src/jquery.js',
vue: bower_dir + '/vue/dist/vue.js',
fullCalendar: bower_dir + '/fullcalendar/dist/fullcalendar.js',
moment: bower_dir + '/moment/moment.js',
}
},
entry: {
app: './library/js/main.js'
},
output: {
path: __dirname + '/dist/library/js',
filename: "bundle.js"
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
Vue: 'vue'
}),
],
module: {
noParse: /moment.js/
}
};
module.exports = config;
I've noticed that my bundle file dramatically increased in file size after both of these were included. I read about similar issues with Moment here and implemented the changes which reduced my uncompressed bundle size from 2.13MB to 1.83MB.
When running the output of webpack --json
through the Webpack Visualiser I notice that Full Calendar is still accountable for a huge percentage of the file size, more so than any of the other libraries I'm including (23.7%, the next highest is jQuery at 15.8% and then Vue.JS at 15.4%).
I'm wondering if anyone knows of any way I can reduce this file size? I currently run webpack -p
in production which reduces the size down to 656kB but this still seems like a lot.