You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/migrate/5.mdx
+42Lines changed: 42 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,24 @@ Webpack 5 requires at least Node.js 10.13.0 (LTS), so make sure you upgrade your
35
35
Some Plugins and Loaders might have a beta version that has to be used in order to be compatible with webpack 5.
36
36
Make sure to read release notes of each individual plugin/loader when upgrading it, since latest version might only support webpack 5 and will fail in v4. In such case, it's recommended to update to the latest version that supports webpack 4.
37
37
38
+
39
+
## Codemods
40
+
41
+
To assist with the upgrade webpack from v4 to v5, we have added features that utilize codemods to automatically update your code to many of the new APIs and patterns. Run the following command to automatically update your code for webpack v5 migration:
42
+
43
+
```bash
44
+
npx codemod webpack/v5/migration-recipe
45
+
```
46
+
47
+
This will run the following codemods from the webpack Codemod repository:
Each of these codemods automates the changes listed in the v5 migration guide. For a complete list of available webpack codemods and further details, see the [codemod registry](https://codemod.com/registry?q=webpack).
54
+
55
+
38
56
### Make sure your build has no errors or warnings
39
57
40
58
There might be new errors or warnings because of the upgraded versions of `webpack`, `webpack-cli`, Plugins and Loaders. Keep an eye for deprecation warnings during the build.
@@ -126,6 +144,14 @@ If you were not able to upgrade some plugins/loaders to the latest in Upgrade we
> (See the [registry here](https://codemod.com/registry/webpack-v5-set-target-to-false-and-update-plugins).)
154
+
129
155
- If you have output.library or output.libraryTarget defined, change the property names: (output.libraryTarget -> output.library.type, output.library -> output.library.name). Example
130
156
131
157
```json
@@ -148,6 +174,14 @@ If you were not able to upgrade some plugins/loaders to the latest in Upgrade we
0 commit comments