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.
This commit is contained in:
ccbikai 2025-05-20 21:12:19 +08:00
parent 125af3a567
commit 13b3f5a8ea
2 changed files with 16 additions and 1 deletions

View file

@ -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: {

View file

@ -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