Skip to content
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

Fix next.config.ts using await in the top-level, breaking npm run dev in new projects #928

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nora-soderlund
Copy link

This PR removes the awaiting of setupDevPlatform and instead adds a catch to log to the console.

Currently, next-on-pages is broken for new projects, since you cannot run npm run dev because of this issue.

Fixes #927 and #925

Copy link

changeset-bot bot commented Jan 3, 2025

⚠️ No Changeset found

Latest commit: 8e30649

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@beratbayram
Copy link

I am sorry if I am missing something but isn't it better to fix it like this:
#925 (comment)

@nora-soderlund
Copy link
Author

nora-soderlund commented Jan 4, 2025

// we only need to use the utility during development so we can check NODE_ENV
// (note: this check is recommended but completely optional)
if (process.env.NODE_ENV === 'development') {
	// `await`ing the call is not necessary but it helps making sure that the setup has succeeded.
	//  If you cannot use top level awaits you could use the following to avoid an unhandled rejection:
	//  `setupDevPlatform().catch(e => console.error(e));`
	await setupDevPlatform();
}

https://github.com/cloudflare/next-on-pages/blob/main/internal-packages/next-dev/README.md#example

potato potato. I don't really care how it is solved or what is the objectively better way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: Can't run with npm run dev
2 participants