-
Notifications
You must be signed in to change notification settings - Fork 143
fix: retrieveCompiledConfig should respect buildOutputPath #1332
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| --- | ||
| "@opennextjs/cloudflare": patch | ||
| --- | ||
|
|
||
| Fix `deploy`/`preview`/`upload`/`populateCache` failing when `buildOutputPath` is set | ||
|
|
||
| `retrieveCompiledConfig` looked for the compiled config under a hardcoded | ||
| `<cwd>/.open-next/.build/`, which does not follow the `buildOutputPath` config. | ||
| Every command that goes through it therefore exited with `Could not find | ||
| compiled Open Next config, did you run the build command?` right after a | ||
| successful build. `build` itself was unaffected because it compiles the config | ||
| from source, so the failure only showed up at deploy time. | ||
|
|
||
| The compiled path cannot simply be prefixed with `buildOutputPath` — that value | ||
| lives in the very config being loaded. When the file is missing, the config is | ||
| now recompiled from source instead (the same path `build` takes; | ||
| `compileOpenNextConfig` emits to a temp dir, so nothing lands in the project). | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,8 +98,11 @@ export async function retrieveCompiledConfig() { | |
| const configPath = path.join(nextAppDir, ".open-next/.build/open-next.config.edge.mjs"); | ||
|
|
||
| if (!existsSync(configPath)) { | ||
| logger.error("Could not find compiled Open Next config, did you run the build command?"); | ||
| process.exit(1); | ||
| // The path above does not follow a custom `buildOutputPath`, which moves the compiled | ||
| // config out of `<cwd>/.open-next`. It cannot be resolved here either -- it lives in | ||
| // the very config we are trying to load. Recompile from the source config instead: | ||
| // `compileOpenNextConfig` emits to a temp dir, so nothing lands in the project. | ||
| return compileConfig(undefined); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Deploying without building first no longer tells the user to run a build When the built output is missing, the command now quietly rebuilds the configuration from source ( Why the fallback swallows the missing-build case
A better shape would be to keep the fallback only after confirming a source config exists, and still surface a build-missing warning/error when the produced worker output is absent. Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback. |
||
| } | ||
|
|
||
| const config = await import(url.pathToFileURL(configPath).href).then((mod) => mod.default); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changeset description does not follow the repository's required message format
The new changeset body starts with a plain sentence instead of the mandated
<type>: <imperative title>first line (.changeset/retrieve-compiled-config-build-output-path.md:5), so the generated changelog entry is inconsistent with every other entry.Impact: The released changelog entry will not carry the required
fix:prefix and imperative title format.Rule reference
CONTRIBUTING.md ("Changeset message format") and AGENTS.md ("Changesets") both require the body to begin with
<TYPE>: <TITLE>where TYPE is one offeature | fix | refactor | docs | chore. The current first line is "Fixdeploy/preview/upload/populateCachefailing whenbuildOutputPathis set".Was this helpful? React with 👍 or 👎 to provide feedback.