Skip to content

Commit

Permalink
use "next/future/image" if `"experimental.images.allowFutureImage": t…
Browse files Browse the repository at this point in the history
…rue` is set in next config (#817)

* use "next/future/image" if `"experimental.images.allowFutureImage": true` is set in next config

* Update packages/nextra/src/mdx-plugins/remark.ts

* replace images with `<NextImage />` even when url not relative but that starts from `/` (public directory) (#819)

* replace images with `<NextImage />` even when url not relative but that starts from `/` (public directory)

* fix build
  • Loading branch information
dimaMachina committed Sep 7, 2022
1 parent 93d028b commit 256154a
Show file tree
Hide file tree
Showing 27 changed files with 630 additions and 529 deletions.
7 changes: 7 additions & 0 deletions .changeset/shiny-apples-speak.md
@@ -0,0 +1,7 @@
---
'nextra': patch
'nextra-theme-blog': patch
'nextra-theme-docs': patch
---

use "next/future/image" if `"experimental.images.allowFutureImage": true` is set in next config
7 changes: 7 additions & 0 deletions .changeset/spotty-swans-explain.md
@@ -0,0 +1,7 @@
---
'nextra': patch
'nextra-theme-docs': patch
'nextra-theme-blog': patch
---

replace images with `<NextImage />` even when url not relative but that starts from `/` (public directory)
3 changes: 3 additions & 0 deletions examples/swr-site/next.config.js
Expand Up @@ -65,5 +65,8 @@ module.exports = withNextra({
reactStrictMode: true,
experimental: {
newNextLinkBehavior: true,
images: {
allowFutureImage: true,
},
},
});
7 changes: 1 addition & 6 deletions examples/swr-site/pages/docs/advanced/_meta.en-US.json
Expand Up @@ -8,11 +8,6 @@
"title": "Do Not Use",
"type": "separator"
},
"cache": "Cache",
"performance": "Performance",
"react-native": "React Native",
"markdown-import": "Markdown import",
"more": "More: A Super Super Super Super Long Directory",
"file-name.with.DOTS": "Filenames with dots",
"code-highlighting": "Code highlighting"
"file-name.with.DOTS": "Filenames with Dots"
}
3 changes: 3 additions & 0 deletions examples/swr-site/pages/docs/advanced/future-image.en-US.mdx
@@ -0,0 +1,3 @@
![](../../../public/favicon/android-chrome-512x512.png)

![](/favicon/android-chrome-512x512.png)
9 changes: 0 additions & 9 deletions examples/swr-site/theme.config.tsx
Expand Up @@ -92,14 +92,6 @@ const config: DocsThemeConfig = {
key: "swr-2",
text: "SWR 2.0 is out! Read more →",
},
bodyExtraContent() {
const router = useRouter();
return (
router.route.startsWith("/docs") && (
<>💪 content from `config.bodyExtraContent`</>
)
);
},
darkMode: true,
docsRepositoryBase:
"https://github.com/shuding/nextra/blob/core/examples/swr-site",
Expand Down Expand Up @@ -128,7 +120,6 @@ const config: DocsThemeConfig = {
);
},
},
gitTimestamp: "Last updated on",
github: "https://github.com/vercel/swr",
head() {
const config = useConfig();
Expand Down
2 changes: 0 additions & 2 deletions packages/nextra-theme-docs/src/constants.tsx
Expand Up @@ -12,8 +12,6 @@ export const DEFAULT_LOCALE = 'en-US'

export const IS_BROWSER = typeof window !== 'undefined'

export const META_FILENAME = '_meta.json'

export const DEFAULT_THEME: DocsThemeConfig = {
banner: {
key: 'nextra-banner',
Expand Down

0 comments on commit 256154a

Please sign in to comment.