N

Next/15/Refactor-experimental.serverComponentsExternalPackages-to-serverExternalPackages

How to Use
Run this codemod on your codebase using one of the following commands

The easiest way to run this codemod without installing anything globally:

Documentation

Refactor experimental.serverComponentsExternalPackages to serverExternalPackages

This codemod refactors the next.config.js file to replace the deprecated experimental.serverComponentsExternalPackages option with the stable serverExternalPackages, improving configuration clarity and maintainability.

  • Find Configuration Object: Identifies the nextConfig object in the code.

  • Property Check: Ensures the presence of the experimental object and its properties that need updating.

  • Move and Rename Property: Moves serverComponentsExternalPackages from the experimental object to the root level and renames it to serverExternalPackages.

  • Clean Up: Removes the experimental object if it becomes empty after the migration.

Before

js

After

js

Ready to contribute?

Build your own codemod and share it with the community.