Skip to content

Commit

Permalink
Delete obsolete codemod next-dynamic-access-named-export (#72016)
Browse files Browse the repository at this point in the history
  • Loading branch information
unstubbable authored and kdy1 committed Oct 30, 2024
1 parent 3a8fc47 commit a083110
Show file tree
Hide file tree
Showing 23 changed files with 5 additions and 254 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,46 +189,6 @@ export function GET(req: NextRequest) {
}
```

#### Transform `next/dynamic` imports accessing named exports to return an object with a `default` property

##### `next-dynamic-access-named-export`

```bash filename="Terminal"
npx @next/codemod@latest next-dynamic-access-named-export .
```

This codemod transforms dynamic imports using `next/dynamic` to ensure they return an object with a `default` property when accessing named exports. This aligns the behavior with `React.lazy` and addresses issues with accessing named exports from client components in server components.

For example:

```js
import dynamic from 'next/dynamic'

const ComponentA = dynamic(() =>
import('../components/a').then((mod) => mod.default)
)

const ComponentB = dynamic(() =>
import('../components/b').then((mod) => mod.ComponentB)
)
```

Transforms into:

```js
import dynamic from 'next/dynamic'

const ComponentA = dynamic(() =>
import('../components/a').then((mod) => ({ default: mod.default }))
)

const ComponentB = dynamic(() =>
import('../components/b').then((mod) => ({ default: mod.ComponentB }))
)
```

> **Good to know**: This codemod only affects dynamic imports using `next/dynamic` and access named exports.
### 14.0

#### Migrate `ImageResponse` imports
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
suggests `next-dynamic-access-named-export` transform
Prompts for React 19 upgrade with a recommendation to do so
Suggests adding `--turbopack` to `next dev` script
Suggests `app-dir-runtime-config-experimental-edge` transform
Suggests `next-async-request-api` transform
Suggests `next-request-geo-ip` transform

This file was deleted.

This file was deleted.

Empty file.

This file was deleted.

This file was deleted.

Empty file.
6 changes: 0 additions & 6 deletions packages/next-codemod/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@ export const TRANSFORMER_INQUIRER_CHOICES = [
value: 'next-og-import',
version: '14.0.0',
},
{
title:
'Transform `next/dynamic` imports accessing named exports to return an object with a `default` property',
value: 'next-dynamic-access-named-export',
version: '15.0.0-canary.44',
},
{
title:
'Install `@vercel/functions` to replace `geo` and `ip` properties on `NextRequest`',
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit a083110

Please sign in to comment.