Skip to content

Commit eca1c52

Browse files
committed
Drop build time from 5 min to < 2
1 parent e9f999e commit eca1c52

File tree

5 files changed

+25
-4
lines changed

5 files changed

+25
-4
lines changed

next.config.mjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ import remarkMermaid from "remark-mermaid";
55
import rehypePrism from "@mapbox/rehype-prism";
66
import rehypeSlug from 'rehype-slug';
77
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
8+
import bundleAnalyzer from "@next/bundle-analyzer";
9+
10+
const withBundleAnalyzer = bundleAnalyzer({
11+
enabled: process.env.ANALYZE === 'true',
12+
});
813

914
/** @type {import('next').NextConfig} */
1015
const nextConfig = {
@@ -18,7 +23,7 @@ const nextConfig = {
1823
"placehold.co",
1924
"avatars.githubusercontent.com"
2025
],
21-
formats: ['image/avif'], // 40% smaller than PNG
26+
formats: ['image/webp'], // Changed from avif to webp
2227
},
2328
transpilePackages: [
2429
"react-tweet",
@@ -173,4 +178,4 @@ const withMDX = nextMDX({
173178
},
174179
});
175180

176-
export default withMDX(nextConfig);
181+
export default withBundleAnalyzer(withMDX(nextConfig));

scripts/create-ai-assisted-dev-tools-comparison-pages.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export const metadata = createMetadata({
3333
slug: "${slug}"
3434
})
3535
36+
export const revalidate = 3600;
37+
3638
export default function Page() {
3739
const tool1 = ${JSON.stringify(tool1)}
3840
const tool2 = ${JSON.stringify(tool2)}

scripts/create-vector-db-comparison-posts.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ export const metadata = {
5353
slug: "${slug}"
5454
}
5555
56+
export const revalidate = 3600;
57+
5658
export default (props) => <ArticleLayout metadata={metadata} {...props} />
5759
5860
<Image src={vectorDatabasesCompared} alt="vector databases compared" />
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use client';
2+
3+
import dynamic from 'next/dynamic';
4+
5+
const TokenizationDemoClient = dynamic(() => import('./TokenizationDemoClient'), {
6+
ssr: false,
7+
loading: () => <div className="text-center p-8">Loading Interactive Demo...</div>,
8+
});
9+
10+
export default function TokenizeDemoLoader() {
11+
return <TokenizationDemoClient />;
12+
}

src/app/demos/tokenize/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Metadata } from 'next'
22
import { Suspense } from 'react'
33
import { createMetadata } from '@/utils/createMetadata'
44
import { Container } from '@/components/Container'
5-
import TokenizationDemoClient from './TokenizationDemoClient'
5+
import TokenizeDemoLoader from './TokenizeDemoLoader'
66

77
export const metadata: Metadata = createMetadata({
88
title: "Interactive tokenization demo for developers",
@@ -24,7 +24,7 @@ export default function TokenizationDemoPage() {
2424
</p>
2525
</header>
2626
<Suspense fallback={<div>Loading...</div>}>
27-
<TokenizationDemoClient />
27+
<TokenizeDemoLoader />
2828
</Suspense>
2929
</div>
3030
</Container>

0 commit comments

Comments
 (0)