1 | # Migration Guide
|
2 |
|
3 | SMP follows [semver](https://semver.org/). This guide should help with upgrading major versions.
|
4 |
|
5 | ## v0 → v1
|
6 |
|
7 | ### If Using Static Constructor
|
8 |
|
9 | If 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 |
|
15 | e.g.
|
16 |
|
17 | ```javascript
|
18 | // v0
|
19 | const webpackConfig = {
|
20 | plugins: SpeedMeasurePlugin.wrapPlugins({
|
21 | FooPlugin: new FooPlugin()
|
22 | }, smpOptions)
|
23 | };
|
24 |
|
25 | // v1
|
26 | const smp = new SpeedMeasurePlugin(smpOptions);
|
27 | const webpackConfig = smp.wrap({
|
28 | plugins: [new FooPlugin()]
|
29 | });
|
30 | ```
|
31 |
|
32 | ### If Using `smp` Instance
|
33 |
|
34 | If you're using the `smp.wrapPlugins(plugins)` method, then
|
35 |
|
36 | * remove all `.wrapPlugins` calls
|
37 | * call `smp.wrap` on your entire config
|
38 |
|
39 | e.g.
|
40 |
|
41 | ```javascript
|
42 | // v0
|
43 | const smp = new SpeedMeasurePlugin(smpOptions);
|
44 | const webpackConfig = {
|
45 | plugins: smp.wrapPlugins({
|
46 | FooPlugin: new FooPlugin()
|
47 | })
|
48 | };
|
49 |
|
50 | // v1
|
51 | const smp = new SpeedMeasurePlugin(smpOptions);
|
52 | const webpackConfig = smp.wrap({
|
53 | plugins: [new FooPlugin()]
|
54 | });
|
55 | ```
|
56 |
|
57 | ### If Using Custom Names
|
58 |
|
59 | v1 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
|
62 | const fooPlugin = new FooPlugin();
|
63 | const smp = new SpeedMeasurePlugin({
|
64 | pluginNames: {
|
65 | customFooPluginName: fooPlugin
|
66 | }
|
67 | });
|
68 | const webpackConfig = smp.wrap({
|
69 | plugins: [fooPlugin]
|
70 | });
|
71 | ```
|