Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete obsolete codemod next-dynamic-access-named-export #72016

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

This file was deleted.

This file was deleted.

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.

Loading