diff --git a/.changeset/quiet-gifts-pay.md b/.changeset/quiet-gifts-pay.md new file mode 100644 index 000000000000..55f304aeb714 --- /dev/null +++ b/.changeset/quiet-gifts-pay.md @@ -0,0 +1,5 @@ +--- +'@astrojs/vercel': patch +--- + +Add missing esbuild dependency diff --git a/.changeset/silver-ties-vanish.md b/.changeset/silver-ties-vanish.md new file mode 100644 index 000000000000..37e994e69db9 --- /dev/null +++ b/.changeset/silver-ties-vanish.md @@ -0,0 +1,7 @@ +--- +'@astrojs/cloudflare': patch +'@astrojs/vercel': patch +'@astrojs/solid-js': patch +--- + +Always build edge/worker runtime with Vite `webworker` SSR target diff --git a/packages/integrations/cloudflare/src/index.ts b/packages/integrations/cloudflare/src/index.ts index a1a726d1336c..46deee2f8141 100644 --- a/packages/integrations/cloudflare/src/index.ts +++ b/packages/integrations/cloudflare/src/index.ts @@ -72,8 +72,8 @@ export default function createIntegration(args?: Options): AstroIntegration { }, 'astro:build:setup': ({ vite, target }) => { if (target === 'server') { - vite.resolve = vite.resolve || {}; - vite.resolve.alias = vite.resolve.alias || {}; + vite.resolve ||= {}; + vite.resolve.alias ||= {}; const aliases = [{ find: 'react-dom/server', replacement: 'react-dom/server.browser' }]; @@ -84,8 +84,8 @@ export default function createIntegration(args?: Options): AstroIntegration { (vite.resolve.alias as Record)[alias.find] = alias.replacement; } } - vite.ssr = vite.ssr || {}; - vite.ssr.target = vite.ssr.target || 'webworker'; + vite.ssr ||= {}; + vite.ssr.target = 'webworker'; } }, 'astro:build:done': async ({ pages }) => { diff --git a/packages/integrations/solid/src/index.ts b/packages/integrations/solid/src/index.ts index 8ec9f4d8d0d6..cfd38224cbbd 100644 --- a/packages/integrations/solid/src/index.ts +++ b/packages/integrations/solid/src/index.ts @@ -45,7 +45,6 @@ async function getViteConfiguration(isDev: boolean, astroConfig: AstroConfig) { exclude: ['@astrojs/solid-js/server.js', ...solidPkgsConfig.optimizeDeps.exclude], }, ssr: { - target: 'node', external: ['babel-preset-solid', ...solidPkgsConfig.ssr.external], noExternal: [...solidPkgsConfig.ssr.noExternal], }, diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json index fd885686b0a1..0f5f7a9eac90 100644 --- a/packages/integrations/vercel/package.json +++ b/packages/integrations/vercel/package.json @@ -50,6 +50,7 @@ "@astrojs/webapi": "^2.1.1", "@vercel/analytics": "^0.1.8", "@vercel/nft": "^0.22.1", + "esbuild": "^0.17.12", "fast-glob": "^3.2.11", "set-cookie-parser": "^2.5.1", "web-vitals": "^3.1.1" diff --git a/packages/integrations/vercel/src/edge/adapter.ts b/packages/integrations/vercel/src/edge/adapter.ts index 96122d43e277..b6f63b707d99 100644 --- a/packages/integrations/vercel/src/edge/adapter.ts +++ b/packages/integrations/vercel/src/edge/adapter.ts @@ -101,7 +101,7 @@ export default function vercelEdge({ } vite.ssr ||= {}; - vite.ssr.target ||= 'webworker'; + vite.ssr.target = 'webworker'; // Vercel edge runtime is a special webworker-ish environment that supports process.env, // but Vite would replace away `process.env` in webworkers, so we set a define here to prevent it diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a39fb6cbeaf3..35fe04342dd1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4713,6 +4713,9 @@ importers: '@vercel/nft': specifier: ^0.22.1 version: 0.22.1 + esbuild: + specifier: ^0.17.12 + version: 0.17.12 fast-glob: specifier: ^3.2.11 version: 3.2.11