Skip to content

Commit

Permalink
Fix <Link> not working correctly with i18n and basepath (#2668)
Browse files Browse the repository at this point in the history
(patch)
  • Loading branch information
flybayer authored Aug 24, 2021
1 parent 827bcf3 commit e49da74
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion nextjs/packages/next/client/link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function linkClicked(
})
}

function Link(props: React.PropsWithChildren<LinkProps>) {
export function Link(props: React.PropsWithChildren<LinkProps>) {
if (process.env.NODE_ENV !== 'production') {
function createPropError(args: {
key: string
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-preset/src/rewrite-imports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
`,
},
Expand Down
1 change: 1 addition & 0 deletions packages/babel-preset/src/rewrite-imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { BabelType } from 'babel-plugin-tester';
const defaultImportSource = '@blitzjs/core';

const specialImports: Record<string, string> = {
Link: 'next/link',
Image: 'next/image',
Script: 'next/script',

Expand Down
4 changes: 4 additions & 0 deletions packages/blitz/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
7 changes: 0 additions & 7 deletions packages/core/src/link.ts

This file was deleted.

0 comments on commit e49da74

Please sign in to comment.