From 13b3f5a8ea0aef7154f31c28475e3b0375482e6f Mon Sep 17 00:00:00 2001 From: ccbikai Date: Tue, 20 May 2025 21:12:19 +0800 Subject: [PATCH] feat: configure workers env and enforce compatibility Enhances Cloudflare Workers configuration and compatibility settings: - Enables worker execution based on provider/runtime conditions - Sets compatibility date specifically for Cloudflare to 2025-05-08 - Enforces module compatibility through experimental flag - Configures Wrangler with proper asset bindings and server entry point This update improves deployment reliability and ensures consistent behavior across different environments. --- nuxt.config.ts | 10 +++++++++- wrangler.toml | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/nuxt.config.ts b/nuxt.config.ts index e57e94f..0b0a1ad 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -1,3 +1,4 @@ +import { provider, runtime } from 'std-env' import { currentLocales } from './i18n/i18n' // https://nuxt.com/docs/api/configuration/nuxt-config @@ -57,7 +58,13 @@ export default defineNuxtConfig({ compatibilityVersion: 4, }, - compatibilityDate: '2024-07-08', + experimental: { + enforceModuleCompatibility: true, + }, + + compatibilityDate: { + cloudflare: '2025-05-08', + }, nitro: { experimental: { @@ -89,6 +96,7 @@ export default defineNuxtConfig({ cache: false, database: false, kv: true, + workers: (provider === 'cloudflare_workers' || runtime === 'node') && provider !== 'cloudflare_pages', }, eslint: { diff --git a/wrangler.toml b/wrangler.toml index 2fc7def..a857961 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -1,5 +1,12 @@ +name = "sink" +main = "dist/server/index.mjs" +compatibility_date = "2025-05-08" upload_source_maps = true +[assets] +directory = "dist/public" +binding = "ASSETS" + [dev] port = 3000