UNPKG

1.5 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 FooPlugin: new FooPlugin()
22 }, smpOptions)
23};
24
25// v1
26const smp = new SpeedMeasurePlugin(smpOptions);
27const webpackConfig = smp.wrap({
28 plugins: [new FooPlugin()]
29});
30```
31
32### If Using `smp` Instance
33
34If you're using the `smp.wrapPlugins(plugins)` method, then
35
36 * remove all `.wrapPlugins` calls
37 * call `smp.wrap` on your entire config
38
39e.g.
40
41```javascript
42// v0
43const smp = new SpeedMeasurePlugin(smpOptions);
44const webpackConfig = {
45 plugins: smp.wrapPlugins({
46 FooPlugin: new FooPlugin()
47 })
48};
49
50// v1
51const smp = new SpeedMeasurePlugin(smpOptions);
52const webpackConfig = smp.wrap({
53 plugins: [new FooPlugin()]
54});
55```
56
57### If Using Custom Names
58
59v1 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:
60
61```javascript
62const fooPlugin = new FooPlugin();
63const smp = new SpeedMeasurePlugin({
64 pluginNames: {
65 customFooPluginName: fooPlugin
66 }
67});
68const webpackConfig = smp.wrap({
69 plugins: [fooPlugin]
70});
71```