Skip to content

Instantly share code, notes, and snippets.

View rowanoulton's full-sized avatar

Rowan Oulton rowanoulton

View GitHub Profile
node --inspect ./node_modules/.bin/webpack
let CrudeTimingPlugin = function() {};
CrudeTimingPlugin.prototype.apply = function(compiler) {
compiler.plugin('compilation', (compilation) => {
let startOptimizePhase;
compilation.plugin('optimize-chunk-assets', (chunks, callback) => {
// Cruddy way of measuring minification time. UglifyJSPlugin does all
// its work in this phase of compilation so we time the duration of
// the entire phase
const CrudeTimingPlugin = require('./crude-timing-plugin');
{
plugins: [
new CrudeTimingPlugin(),
],
}
@rowanoulton
rowanoulton / crude-timing-plugin.js
Created January 16, 2018 17:28
A webpack plugin that crudely measures the execution time of UglifyJSPlugin
let CrudeTimingPlugin = function() {};
CrudeTimingPlugin.prototype.apply = function(compiler) {
compiler.plugin('compilation', (compilation) => {
let startOptimizePhase;
compilation.plugin('optimize-chunk-assets', (chunks, callback) => {
// Cruddy way of measuring minification time. UglifyJSPlugin does all
// its work in this phase of compilation so we time the duration of
// the entire phase
const CrudeTimingPlugin = require('./crude-timing-plugin');
module.exports = {
plugins: [
new CrudeTimingPlugin(),
new UglifyJSPlugin(),
]
};
new UglifyJsPlugin({
uglifyOptions: {
compress: {
arrows: false,
booleans: false,
cascade: false,
collapse_vars: false,
comparisons: false,
computed_props: false,
hoist_funs: false,
{
0: "d4920286de51402132dc", /* ← hash for the application bundle */
1: "29a3cf9344f1503c9f8f",
2: "e22b11ab6e327c7da035",
/* .. and so on ... */
}