A

webpack/v5/json-imports-to-default-imports

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

This codemod migrates imports from JSON modules that use named exports to use default exports instead.

This codemod transforms named imports from JSON files into default imports, adhering to the new ECMAScript specification and Webpack v5 compatibility. Named imports from JSON modules are no longer supported.

Example

Before

ts

After

ts

,

Before

ts

After

ts

,

Before

ts

After

ts

,

Before

ts

After

ts

Ready to contribute?

Build your own codemod and share it with the community.