Skip to content

Generate app/env.d.ts and server/env.d.ts for Nuxt applications#12820

Merged
dario-piotrowicz merged 1 commit intomainfrom
dario/11727/c3-nuxt-types
Mar 10, 2026
Merged

Generate app/env.d.ts and server/env.d.ts for Nuxt applications#12820
dario-piotrowicz merged 1 commit intomainfrom
dario/11727/c3-nuxt-types

Conversation

@dario-piotrowicz
Copy link
Copy Markdown
Member

@dario-piotrowicz dario-piotrowicz commented Mar 9, 2026

Fixes #11727

Previously, only a top-level env.d.ts was created, which meant server files didn't receive Cloudflare types. Now the CLI generates separate app/env.d.ts and server/env.d.ts files, both importing from a shared _cloudflare/env.d.ts to avoid duplication.

This ensures Cloudflare types are available in both app and server directories.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
      • Run this PR's C3 prerelease to create a Nuxt application
      • Create an api/hello.ts file in the server directory with the following content:
        export default defineEventHandler((event) => {
           const { cloudflare } = event.context;
        
           return 'Hello';
        });
      • run the build script (that generates the Nuxt types)
      • ensure that the cloudflare context has the correct type (i.e. it is not an any nor unknown)
    • Additional testing not necessary because:
  • Public documentation

A picture of a cute animal (not mandatory, but encouraged)


Open with Devin

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 9, 2026

🦋 Changeset detected

Latest commit: 87a5283

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 9, 2026

✅ All changesets look good

@ask-bonk

This comment was marked as outdated.

@ask-bonk

This comment was marked as outdated.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Mar 9, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@12820

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@12820

miniflare

npm i https://pkg.pr.new/miniflare@12820

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@12820

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@12820

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@12820

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@12820

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@12820

wrangler

npm i https://pkg.pr.new/wrangler@12820

commit: ea10dd4

@dario-piotrowicz dario-piotrowicz force-pushed the dario/11727/c3-nuxt-types branch from a3fa160 to 87a5283 Compare March 9, 2026 19:36
@dario-piotrowicz dario-piotrowicz marked this pull request as ready for review March 9, 2026 22:38
@dario-piotrowicz dario-piotrowicz requested a review from a team as a code owner March 9, 2026 22:38
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Mar 9, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Mar 10, 2026
@dario-piotrowicz dario-piotrowicz merged commit 556bce0 into main Mar 10, 2026
40 of 44 checks passed
@dario-piotrowicz dario-piotrowicz deleted the dario/11727/c3-nuxt-types branch March 10, 2026 22:47
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[create-cloudflare]: Cloudflare type inference in Nuxt v4 doesn't work

3 participants