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

Minimum set of changes to make bindings work locally #1

Closed
wants to merge 1 commit into from

Conversation

irvinebroque
Copy link
Owner

No description provided.

@@ -34,3 +34,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

# wrangler
.wrangler
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The template we give people should ignore .wrangler, otherwise you end up committing the temp state of local dev to git history accidentally.

@@ -2,3 +2,17 @@
const nextConfig = {}

module.exports = nextConfig

// Everything below *needs* to be part of the default template that running npm create cloudflare@latest gives you
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ needs to be default, not opt-in.

@@ -2,3 +2,17 @@
const nextConfig = {}

module.exports = nextConfig

// Everything below *needs* to be part of the default template that running npm create cloudflare@latest gives you
// It needs to be documented in real dev docs
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has to be loud, at the top of any getting started path we have (since many people will have existing Next.js apps, or be creating them outside of npm create cloudflare@latest, outside of dash.

// Everything below *needs* to be part of the default template that running npm create cloudflare@latest gives you
// It needs to be documented in real dev docs
// It needs to be the happy path, not optional thing you discover later
// Assume that every single developer will use one or more of these in their app
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ really important.

if (process.env.NODE_ENV === 'development') {
import('@cloudflare/next-on-pages/__experimental__next-dev').then(({ setupDevBindings }) => {

// When Pages has wrangler.toml, just read from that in current directory and can skip this config
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a big part of why getting Pages wrangler.toml matters so much.

// When Pages has wrangler.toml, just read from that in current directory and can skip this config
setupDevBindings({
kvNamespaces: ['MY_KV_1', 'MY_KV_2'],
});
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ this is effectively making people re-create what would otherwise be in wrangler.toml.

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.

1 participant