diff --git a/packages/next-codemod/transforms/async-request-api/index.ts b/packages/next-codemod/transforms/async-request-api/index.ts index b85f88d8ef3418..e1afa5f894197f 100644 --- a/packages/next-codemod/transforms/async-request-api/index.ts +++ b/packages/next-codemod/transforms/async-request-api/index.ts @@ -3,6 +3,11 @@ import { transformDynamicProps } from './next-async-dynamic-prop' import { transformDynamicAPI } from './next-async-dynamic-api' export default function transform(file: FileInfo, api: API) { + const filePath = file.path + // if it's node_modules or types file, skip + if (/node_modules/.test(filePath) || /\.d\.(m|c)?ts$/.test(filePath)) { + return file.source + } const transforms = [transformDynamicProps, transformDynamicAPI] return transforms.reduce((source, transformFn) => {