-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Auto generated open-next.config.ts is invalid #427
Comments
What do you mean by "I get an errors"? Do you get a crash?
|
He most likely gets the following: ┌─────────────────────────────┐
│ OpenNext — Cloudflare build │
└─────────────────────────────┘
✘ [ERROR] Could not resolve "@opennextjs/cloudflare/dist/api/config"
open-next.config.ts:2:39:
2 │ import { defineCloudflareConfig } from "@opennextjs/cloudflare/dist/api/config";
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The module "./dist/api/dist/api/config.js" was not found on the file system:
node_modules/@opennextjs/cloudflare/package.json:18:16:
18 │ "import": "./dist/api/*.js",
╵ ~~~~~~~~~~~~~~~~~
You can mark the path "@opennextjs/cloudflare/dist/api/config" as external to exclude it from the
bundle, which will remove this error.
✘ [ERROR] Could not resolve "@opennextjs/cloudflare/dist/api/kv-cache"
open-next.config.ts:3:31:
3 │ import kvIncrementalCache from "@opennextjs/cloudflare/dist/api/kv-cache";
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The module "./dist/api/dist/api/kv-cache.js" was not found on the file system:
node_modules/@opennextjs/cloudflare/package.json:18:16:
18 │ "import": "./dist/api/*.js",
╵ ~~~~~~~~~~~~~~~~~
You can mark the path "@opennextjs/cloudflare/dist/api/kv-cache" as external to exclude it from
the bundle, which will remove this error.
node:internal/modules/run_main:122
triggerUncaughtException(
^
Error: Build failed with 2 errors:
open-next.config.ts:2:39: ERROR: Could not resolve "@opennextjs/cloudflare/dist/api/config"
open-next.config.ts:3:31: ERROR: Could not resolve "@opennextjs/cloudflare/dist/api/kv-cache" |
@JasonGiedymin is correct. Those are the errors I was seeing |
@dario-piotrowicz can you please take a look? |
Can you try to change: // before
import { defineCloudflareConfig } from "@opennextjs/cloudflare/dist/api/config";
import kvIncrementalCache from "@opennextjs/cloudflare/dist/api/kv-cache";
// after
import { defineCloudflareConfig } from "@opennextjs/cloudflare/config";
import kvIncrementalCache from "@opennextjs/cloudflare/kv-cache"; |
Describe the bug
While playing with
opennextjs/cloudflare
I decided to following the manual instructions found here which in step 4. highlights its optional and will be auto generated.However when auto generating the file via
npm run preview
I get an errors, the code added to the new fileopen-next.config.ts
is as follows inline with the documentation;However if I was to look at a project created using
npm create cloudflare@latest -- my-next-app --framework=next --experimental
it would be as follows;Steps to reproduce
npm run preview
after step 6Expected behavior
Preview starts after valid config is added
@opennextjs/cloudflare version
0.5.6
Wrangler version
3.111.0
next info output
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 24.4.0: Sat Feb 15 22:49:30 PST 2025; root:xnu-11417.100.533.501.4~3/RELEASE_ARM64_T6020 Available memory (MB): 32768 Available CPU cores: 12 Binaries: Node: 22.12.0 npm: 10.9.0 Yarn: N/A pnpm: 9.15.2 Relevant Packages: next: 15.2.0 // Latest available version is detected (15.2.0). eslint-config-next: N/A react: 19.0.0 react-dom: 19.0.0 typescript: 5.8.2 Next.js Config: output: N/A
Additional context
No response
The text was updated successfully, but these errors were encountered: