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