Skip to content

Commit e1d8c66

Browse files
committed
refactor: simplify CF dev init approach on next.config
- Use static import pattern for better predictability - Rely on NODE_ENV for standard development environment detection - Streamline configuration by removing dynamic import complexity
1 parent 3d5588a commit e1d8c66

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

next.config.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
import type { NextConfig } from "next";
1+
import { initOpenNextCloudflareForDev } from "@opennextjs/cloudflare";
22

3-
const nextConfig: NextConfig = {
3+
/** @type {import("next").NextConfig} */
4+
const nextConfig = {
45
/* config options here */
56
};
67

7-
// Only run during `next dev`, not during `next build`
8-
if (process.argv.includes("dev")) {
9-
import("@opennextjs/cloudflare").then(
10-
({ initOpenNextCloudflareForDev }) => {
11-
initOpenNextCloudflareForDev();
12-
},
13-
);
8+
if (process.env.NODE_ENV === "development") {
9+
initOpenNextCloudflareForDev();
1410
}
1511

1612
export default nextConfig;

0 commit comments

Comments
 (0)