-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed as not planned
Labels
Description
Environment
- Operating System: Windows_NT
- Node Version: v20.11.1
- Nuxt Version: 3.10.3
- CLI Version: 3.10.1
- Nitro Version: -
- Package Manager: [email protected]
- Builder: -
- User Config: devtools, runtimeConfig, nitro
- Runtime Modules: -
- Build Modules: -
Reproduction
The reproduction is increadibly simple. Create a new Nuxt app with pnpm dlx nuxi@latest init <project-name>
.
nuxt.config.ts
export default defineNuxtConfig({
devtools: {enabled: true},
runtimeConfig: {
public: {
exampleValue: "unknown"
}
},
nitro: {
preset: "cloudflare-pages"
}
})
app.vue
<template>
<div>
<strong>Config:</strong>
<pre>{{ config}}</pre>
</div>
</template>
<script setup lang="ts">
const config = useRuntimeConfig();
</script>
Build the Nuxt app with nuxt build
then deploy it to Cloudflare using pnpm dlx wrangler pages deploy dist/
.
Describe the bug
When the Nuxt app is deployed to Cloudflare Pages using the cloudflare-pages
nitro preset, environment variables aren't passed down into Nuxt. Unless I've missed a step in configuring the Nuxt app or something else in Cloudflare, I would expect the public.exampleValue
to be overridden with my environment value.
The hosted Nuxt app can be found here: https://pages-env-demo-55q.pages.dev/
My environment variable in Cloudflare Pages are configured like so:
Additional context
No response
Logs
No response