1- # Speed Measure Webpack Plugin
2-
3- ** _ (this plugin is not yet stable, and not safe for production)_ **
1+ # Speed Measure Plugin
42
53This plugin measures your webpack build speed, giving an output like this:
64
@@ -32,15 +30,15 @@ file-loader took 7.11 seconds
3230
3331# Getting Started
3432
35- ` npm install --save-dev speed-measure-webpack-plugin `
33+ ` npm install --save speed-measure-webpack-plugin `
3634
3735Change your webpack config from
3836
39- ```
37+ ``` javascript
4038{
41- entry: {...},
42- output: {...},
43- module: {...},
39+ entry: {/* ...*/ },
40+ output: {/* ...*/ },
41+ module: {/* ...*/ },
4442 plugins: [
4543 new MyPlugin (),
4644 new MyOtherPlugin ()
@@ -50,11 +48,13 @@ Change your webpack config from
5048
5149to
5250
53- ```
51+ ``` javascript
52+ const SpeedMeasurePlugin = require (" speed-measure-webpack-plugin" );
53+
5454{
55- entry: {...},
56- output: {...},
57- module: {...},
55+ entry: {/* ...*/ },
56+ output: {/* ...*/ },
57+ module: {/* ...*/ },
5858 plugins: SpeedMeasurePlugin .wrapPlugins ({
5959 MyPlugin: new MyPlugin (),
6060 MyOtherPlugin: new MyOtherPlugin ()
6464
6565Or you can also specify config:
6666
67- ```
67+ ``` javascript
68+ const SpeedMeasurePlugin = require (" speed-measure-webpack-plugin" );
69+
6870{
69- entry: {...},
70- output: {...},
71- module: {...},
71+ entry: {/* ...*/ },
72+ output: {/* ...*/ },
73+ module: {/* ...*/ },
7274 plugins: SpeedMeasurePlugin .wrapPlugins ({
7375 MyPlugin: new MyPlugin (),
7476 MyOtherPlugin: new MyOtherPlugin ()
@@ -79,6 +81,38 @@ Or you can also specify config:
7981}
8082```
8183
84+ If you're using ` webpack-merge ` , then you can do:
85+
86+ ``` javascript
87+ // base config file
88+ const smp = new SpeedMeasurePlugin ({
89+ outputFormat: " human"
90+ });
91+
92+ const finalConfig = webpackMerge (
93+ [baseConfig, envSpecificConfig].map (configGenerator =>
94+ configGenerator ({
95+ smp,
96+ // other options
97+ })
98+ )
99+ );
100+
101+ // baseConfig
102+ export const baseConfig = ({ smp }) => ({
103+ plugins: smp .wrapPlugins ({
104+ MyPlugin: new MyPlugin ()
105+ }).concat (smp)
106+ })
107+
108+ // envSpecificConfig
109+ export const envSpecificConfig = ({ smp }) => ({
110+ plugins: smp .wrapPlugins ({
111+ MyOtherPlugin: new MyOtherPlugin ()
112+ })
113+ })
114+ ```
115+
82116## ` outputFormat ` ##
83117
84118(default ` "json" ` )
0 commit comments