This repository contains codemods (automated migrations) for webpack. These codemods facilitate adopting new features and upgrading to versions with breaking changes.
# Run a specific codemod from the registry
npx codemod@latest webpack/v5/json-imports-to-default-imports
# Run the combined migration recipe
npx codemod@latest webpack/v5/migration-recipe
# Run locally from a recipe directory
codemod run -w workflow.yaml
See the codemod CLI doc for a full list of available commands.
Caution
These scripts change source code. Remember to commit any wanted and unsaved changes before running them.
To run codemods, use codemod
command below:
npx codemod @webpack/<recipe>
webpack/v5/json-imports-to-default-imports
— replace JSON named imports with default importwebpack/v5/migrate-library-target-to-library-object
— migrateoutput.library
andoutput.libraryTarget
to v5 formatwebpack/v5/set-target-to-false-and-update-plugins
— move functionaltarget
intoplugins
and settarget: false
webpack/v5/migration-recipe
— orchestrates the above in sequence
See CONTRIBUTING.md. Please commit or stash your changes before running codemods.
See SECURITY.md. Report vulnerabilities privately.
MIT