N

nuxt/2/convert-nuxt.js-config-to-the-`defineNuxtConfig`

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

Convert Nuxt.js Config to defineNuxtConfig

This codemod helps you migrate your Nuxt.js configuration files to use the new defineNuxtConfig format. This is useful when updating to a newer version of Nuxt.js that supports this method for defining configuration.

The codemod transforms the existing export default Nuxt.js configuration objects into the defineNuxtConfig function call. This standardizes the configuration format and ensures compatibility with the latest Nuxt.js features.

Example Transformations

Below are some examples demonstrating how the codemod transforms the configuration:

Example 1

Before:

ts

After

ts

Ready to contribute?

Build your own codemod and share it with the community.