-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathnext.config.ts
More file actions
33 lines (30 loc) · 1.37 KB
/
Copy pathnext.config.ts
File metadata and controls
33 lines (30 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import type { NextConfig } from "next";
import createNextIntlPlugin from "next-intl/plugin";
const withNextIntl = createNextIntlPlugin("./src/i18n/request.ts");
const nextConfig: NextConfig = {
// Next's default serverExternalPackages list includes @libsql/client, which
// leaves it un-bundled — on Cloudflare Workers that external require fails
// at runtime. Force it into the server bundle instead (its /web entry is
// pure fetch/WebSocket, safe on every runtime we deploy to).
// @ghfind/i18n is a source-only workspace package (TypeScript exports).
transpilePackages: ["@libsql/client", "@ghfind/i18n"],
// A stray lockfile in the home dir makes Next infer the wrong workspace root.
// Pin it to this project.
turbopack: {
root: __dirname,
},
// NOTE: the agent RFC-8288 Link header is set on the markdown/doc route
// responses (src/lib/agent-docs.ts AGENT_LINK_HEADER) and appended to HTML
// pages by the middleware (src/proxy.ts) — not here, because next.config
// headers() is defeated by the locale rewrite.
async rewrites() {
return {
afterFiles: [
// Markdown twin for blog posts: /blog/{slug}.md -> the raw-markdown handler.
{ source: "/blog/:slug.md", destination: "/blog-md/:slug" },
{ source: "/en/blog/:slug.md", destination: "/blog-md/:slug" },
],
};
},
};
export default withNextIntl(nextConfig);