This guide is meant to serve as a reference for updating Webpack to version 5 for projects based off of the WP Starter theme using Webpack version 4. Many of the steps needed to update Webpack are not covered in the Webpack migration guide To v5 from v4 | webpack .
For the majority of the update you can use these two references:
- Follow the steps in the Webpack v4 to v5 migration guide: To v5 from v4 | webpack
- Reference these changes against your theme for prior art: https://github.com/alleyinteractive/wp-starter-theme/pull/253/files
To see what versions you are running and what the latest versions are you can run
npm outdated in your terminal to see which packages need to be updated.
The sections below represent the different changes needed across your project: