diff --git a/nextjs/packages/next/client/link.tsx b/nextjs/packages/next/client/link.tsx index eaafb68a09..bb8473bcd5 100644 --- a/nextjs/packages/next/client/link.tsx +++ b/nextjs/packages/next/client/link.tsx @@ -106,7 +106,7 @@ function linkClicked( }) } -function Link(props: React.PropsWithChildren) { +export function Link(props: React.PropsWithChildren) { if (process.env.NODE_ENV !== 'production') { function createPropError(args: { key: string diff --git a/packages/babel-preset/src/rewrite-imports.test.ts b/packages/babel-preset/src/rewrite-imports.test.ts index f61ee9b4ae..8120c9c638 100644 --- a/packages/babel-preset/src/rewrite-imports.test.ts +++ b/packages/babel-preset/src/rewrite-imports.test.ts @@ -16,14 +16,14 @@ pluginTester({ { code: `import {Image, Link} from 'blitz';`, output: ` - import { Link } from '@blitzjs/core'; + import { Link } from 'next/link'; import { Image } from 'next/image'; `, }, { code: `import {Image as BlitzImage, Link} from 'blitz';`, output: ` - import { Link } from '@blitzjs/core'; + import { Link } from 'next/link'; import { Image as BlitzImage } from 'next/image'; `, }, diff --git a/packages/babel-preset/src/rewrite-imports.ts b/packages/babel-preset/src/rewrite-imports.ts index 2f3ffab446..79688b1e44 100644 --- a/packages/babel-preset/src/rewrite-imports.ts +++ b/packages/babel-preset/src/rewrite-imports.ts @@ -8,6 +8,7 @@ import { BabelType } from 'babel-plugin-tester'; const defaultImportSource = '@blitzjs/core'; const specialImports: Record = { + Link: 'next/link', Image: 'next/image', Script: 'next/script', diff --git a/packages/blitz/src/index.ts b/packages/blitz/src/index.ts index 452d0fee26..f684d7e0d6 100644 --- a/packages/blitz/src/index.ts +++ b/packages/blitz/src/index.ts @@ -13,8 +13,12 @@ export * from "@blitzjs/core/server" */ export {default as Image} from "next/image" export type {ImageProps, ImageLoader, ImageLoaderProps} from "next/image" + +export * from "next/link" + export {Script} from "next/script" export type {Props as ScriptProps} from "next/script" + export * from "next/stdlib" export * from "next/stdlib-server" export * from "next/data-client" diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index baa0aa1cd8..44b1e024af 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,6 +1,5 @@ export * from "./types" export * from "./router" -export * from "./link" export * from "./error" export * from "./error-boundary" export {withBlitzAppRoot} from "./blitz-app-root" diff --git a/packages/core/src/link.ts b/packages/core/src/link.ts deleted file mode 100644 index e2d478e238..0000000000 --- a/packages/core/src/link.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* - * IF YOU CHANGE THIS FILE - * You also need to update the rewrite map in - * packages/babel-preset/src/rewrite-imports.ts - */ -export {default as Link} from "next/link" -export type {LinkProps} from "next/link"