From ddfbef5acbd4c56d8ce1626a458b5cbb27da47fe Mon Sep 17 00:00:00 2001 From: Erika <3019731+Princesseuh@users.noreply.github.com> Date: Fri, 14 Oct 2022 15:16:41 -0300 Subject: [PATCH 1/2] Fix `astro add` adding lines from extended configurations (#5095) --- .changeset/gorgeous-baboons-sleep.md | 5 +++++ .changeset/neat-phones-sin.md | 5 +++++ packages/astro/src/core/config/tsconfig.ts | 2 ++ packages/integrations/react/package.json | 3 ++- 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .changeset/gorgeous-baboons-sleep.md create mode 100644 .changeset/neat-phones-sin.md diff --git a/.changeset/gorgeous-baboons-sleep.md b/.changeset/gorgeous-baboons-sleep.md new file mode 100644 index 000000000000..98975c390838 --- /dev/null +++ b/.changeset/gorgeous-baboons-sleep.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix `astro add` trying to add lines from extended configurations when adding frameworks diff --git a/.changeset/neat-phones-sin.md b/.changeset/neat-phones-sin.md new file mode 100644 index 000000000000..9a77e4731f41 --- /dev/null +++ b/.changeset/neat-phones-sin.md @@ -0,0 +1,5 @@ +--- +'@astrojs/react': patch +--- + +Add `@types/` packages as peerDependencies diff --git a/packages/astro/src/core/config/tsconfig.ts b/packages/astro/src/core/config/tsconfig.ts index be73af077ab9..7ffb88087111 100644 --- a/packages/astro/src/core/config/tsconfig.ts +++ b/packages/astro/src/core/config/tsconfig.ts @@ -56,6 +56,7 @@ export function loadTSConfig(cwd: string | undefined, resolve = true): tsr.TsCon let config = tsr.tsconfigResolverSync({ cwd, filePath: resolve ? undefined : cwd, + ignoreExtends: !resolve, }); // When a direct filepath is provided to `tsconfigResolver`, it'll instead return invalid-config even when @@ -70,6 +71,7 @@ export function loadTSConfig(cwd: string | undefined, resolve = true): tsr.TsCon cwd, filePath: resolve ? undefined : cwd, searchName: 'jsconfig.json', + ignoreExtends: !resolve, }); if ( diff --git a/packages/integrations/react/package.json b/packages/integrations/react/package.json index 980752eec5a5..d4519025a2e2 100644 --- a/packages/integrations/react/package.json +++ b/packages/integrations/react/package.json @@ -48,7 +48,8 @@ "peerDependencies": { "react": "^17.0.2 || ^18.0.0", "react-dom": "^17.0.2 || ^18.0.0", - "@types/react": "^17.0.50 || ^18.0.21" + "@types/react": "^17.0.50 || ^18.0.21", + "@types/react-dom": "^17.0.17 || ^18.0.6" }, "engines": { "node": "^14.18.0 || >=16.12.0" From f8198d2502bbf7f7daf5854e7e12317e39a66fcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Seery?= Date: Fri, 14 Oct 2022 17:17:13 -0300 Subject: [PATCH 2/2] feat(vercel): Edge improvements (#5086) * Added error on "output" == "static" * Minify output * Changeset --- .changeset/hot-dogs-leave.md | 5 +++++ packages/integrations/vercel/src/edge/adapter.ts | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 .changeset/hot-dogs-leave.md diff --git a/.changeset/hot-dogs-leave.md b/.changeset/hot-dogs-leave.md new file mode 100644 index 000000000000..808322209550 --- /dev/null +++ b/.changeset/hot-dogs-leave.md @@ -0,0 +1,5 @@ +--- +'@astrojs/vercel': minor +--- + +Minify Edge Function output to save space diff --git a/packages/integrations/vercel/src/edge/adapter.ts b/packages/integrations/vercel/src/edge/adapter.ts index 018ab703260f..c842cb38ffc0 100644 --- a/packages/integrations/vercel/src/edge/adapter.ts +++ b/packages/integrations/vercel/src/edge/adapter.ts @@ -39,6 +39,13 @@ export default function vercelEdge(): AstroIntegration { _config = config; serverEntry = config.build.serverEntry; functionFolder = config.build.server; + + if (config.output === 'static') { + throw new Error(` + [@astrojs/vercel] \`output: "server"\` is required to use the edge adapter. + + `); + } }, 'astro:build:start': ({ buildConfig }) => { if (needsBuildConfig) { @@ -66,6 +73,9 @@ export default function vercelEdge(): AstroIntegration { target: 'webworker', noExternal: true, }; + + vite.build ||= {}; + vite.build.minify = true; } }, 'astro:build:done': async ({ routes }) => {