Webpack: add SpeedMeasurePlugin

This commit is contained in:
Alex Gleason 2021-09-04 15:19:50 -05:00
parent 73baa1f55c
commit 9700deeba5
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
4 changed files with 18 additions and 5 deletions

View file

@ -132,6 +132,7 @@
"sass": "^1.20.3", "sass": "^1.20.3",
"sass-loader": "^10.0.0", "sass-loader": "^10.0.0",
"semver": "^7.3.2", "semver": "^7.3.2",
"speed-measure-webpack-plugin": "^1.5.0",
"stringz": "^2.0.0", "stringz": "^2.0.0",
"substring-trie": "^1.0.2", "substring-trie": "^1.0.2",
"terser-webpack-plugin": "^4.2.3", "terser-webpack-plugin": "^4.2.3",

View file

@ -2,8 +2,11 @@
console.log('Running in development mode'); // eslint-disable-line no-console console.log('Running in development mode'); // eslint-disable-line no-console
const { merge } = require('webpack-merge'); const { merge } = require('webpack-merge');
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');
const sharedConfig = require('./shared'); const sharedConfig = require('./shared');
const smp = new SpeedMeasurePlugin();
const watchOptions = {}; const watchOptions = {};
const backendUrl = process.env.BACKEND_URL || 'http://localhost:4000'; const backendUrl = process.env.BACKEND_URL || 'http://localhost:4000';
@ -48,7 +51,7 @@ if (process.env.VAGRANT) {
watchOptions.poll = 1000; watchOptions.poll = 1000;
} }
module.exports = merge(sharedConfig, { module.exports = smp.wrap(merge(sharedConfig, {
mode: 'development', mode: 'development',
cache: true, cache: true,
devtool: 'source-map', devtool: 'source-map',
@ -94,4 +97,4 @@ module.exports = merge(sharedConfig, {
serveIndex: true, serveIndex: true,
proxy: makeProxyConfig(), proxy: makeProxyConfig(),
}, },
}); }));

View file

@ -6,10 +6,12 @@ const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const OfflinePlugin = require('offline-plugin'); const OfflinePlugin = require('offline-plugin');
const TerserPlugin = require('terser-webpack-plugin'); const TerserPlugin = require('terser-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin'); const CompressionPlugin = require('compression-webpack-plugin');
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');
const sharedConfig = require('./shared'); const sharedConfig = require('./shared');
module.exports = merge(sharedConfig, { const smp = new SpeedMeasurePlugin();
module.exports = smp.wrap(merge(sharedConfig, {
mode: 'production', mode: 'production',
devtool: 'source-map', devtool: 'source-map',
stats: 'normal', stats: 'normal',
@ -97,4 +99,4 @@ module.exports = merge(sharedConfig, {
// }, // },
}), }),
], ],
}); }));

View file

@ -11536,6 +11536,13 @@ specificity@^0.4.1:
resolved "https://registry.yarnpkg.com/specificity/-/specificity-0.4.1.tgz#aab5e645012db08ba182e151165738d00887b019" resolved "https://registry.yarnpkg.com/specificity/-/specificity-0.4.1.tgz#aab5e645012db08ba182e151165738d00887b019"
integrity sha512-1klA3Gi5PD1Wv9Q0wUoOQN1IWAuPu0D1U03ThXTr0cJ20+/iq2tHSDnK7Kk/0LXJ1ztUB2/1Os0wKmfyNgUQfg== integrity sha512-1klA3Gi5PD1Wv9Q0wUoOQN1IWAuPu0D1U03ThXTr0cJ20+/iq2tHSDnK7Kk/0LXJ1ztUB2/1Os0wKmfyNgUQfg==
speed-measure-webpack-plugin@^1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/speed-measure-webpack-plugin/-/speed-measure-webpack-plugin-1.5.0.tgz#caf2c5bee24ab66c1c7c30e8daa7910497f7681a"
integrity sha512-Re0wX5CtM6gW7bZA64ONOfEPEhwbiSF/vz6e2GvadjuaPrQcHTQdRGsD8+BE7iUOysXH8tIenkPCQBEcspXsNg==
dependencies:
chalk "^4.1.0"
split-string@^3.0.1, split-string@^3.0.2: split-string@^3.0.1, split-string@^3.0.2:
version "3.1.0" version "3.1.0"
resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2"