deprecated_overflow_webapp/config/webpack/webpack.config.stats.js

33 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

2017-12-18 08:06:05 +00:00
///////////////////////////////////////////////////////////////////////////////////////////////////
// WebPack 2 STATS Config
///////////////////////////////////////////////////////////////////////////////////////////////////
//
//
// REMEMBER UPLOAD YOUR stats.json to http://webpack.github.io/analyse/
// IMPORTANT. If you use console.log in this file, the stats.json will not work...
// TODO. Include fileDateTime in stats.json as well.
//
///////////////////////////////////////////////////////////////////////////////////////////////////
const Visualizer = require('webpack-visualizer-plugin');
const WebpackMerge = require('webpack-merge');
////////////////////////////////////////////////
// File name for Visualizer
////////////////////////////////////////////////
const currentDateTime = new Date();
const currentDate = currentDateTime.toLocaleDateString('en-GB').replace(/\//g, "-");
const currentTime = currentDateTime.toLocaleTimeString('en-GB', { hour12: false }).replace(/:/g, "-");
const fileDateTime = currentDate + "-" + currentTime;
const statisticsFileName = './stats/statistics-' + fileDateTime + '.html';
const configBase = require('./webpack.config.prod.js');
module.exports = WebpackMerge(configBase, {
plugins: [
new Visualizer({
filename: statisticsFileName
})
]
});