UNPKG

1.51 kBMarkdownView Raw
1# Migration Guide
2
3SMP follows [semver](https://semver.org/). This guide should help with upgrading major versions.
4
5## v0 → v1
6
7### If Using Static Constructor
8
9If you're using the `SpeedMeasurePlugin.wrapPlugins(plugins, options)` static method, then
10
11- remove all `.wrapPlugins` calls
12- instantiate an `smp`
13- call `smp.wrap` on your entire config
14
15e.g.
16
17```javascript
18// v0
19const webpackConfig = {
20 plugins: SpeedMeasurePlugin.wrapPlugins(
21 {
22 FooPlugin: new FooPlugin(),
23 },
24 smpOptions
25 ),
26};
27
28// v1
29const smp = new SpeedMeasurePlugin(smpOptions);
30const webpackConfig = smp.wrap({
31 plugins: [new FooPlugin()],
32});
33```
34
35### If Using `smp` Instance
36
37If you're using the `smp.wrapPlugins(plugins)` method, then
38
39- remove all `.wrapPlugins` calls
40- call `smp.wrap` on your entire config
41
42e.g.
43
44```javascript
45// v0
46const smp = new SpeedMeasurePlugin(smpOptions);
47const webpackConfig = {
48 plugins: smp.wrapPlugins({
49 FooPlugin: new FooPlugin(),
50 }),
51};
52
53// v1
54const smp = new SpeedMeasurePlugin(smpOptions);
55const webpackConfig = smp.wrap({
56 plugins: [new FooPlugin()],
57});
58```
59
60### If Using Custom Names
61
62v1 no longer requires you to manually enter each plugin name. If you want to keep any of your custom plugin names, then you can use the new `options.pluginNames` option:
63
64```javascript
65const fooPlugin = new FooPlugin();
66const smp = new SpeedMeasurePlugin({
67 pluginNames: {
68 customFooPluginName: fooPlugin,
69 },
70});
71const webpackConfig = smp.wrap({
72 plugins: [fooPlugin],
73});
74```