From fdbe8facac03d5d49b10e5d1f406752740fe7b29 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Thu, 19 Sep 2024 14:58:34 +0200 Subject: [PATCH] skip types --- packages/next-codemod/transforms/async-request-api/index.ts | 5 +++++ 1 file changed, 5 insertions(+) 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) => {