From f862a7844349ab3a233fdc67e0cc8025fde385c6 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 22 Apr 2022 12:39:47 -0400 Subject: [PATCH] ensure tmp dir is created (#4694) --- .changeset/eight-pets-clean.md | 5 +++++ packages/adapter-netlify/index.js | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 .changeset/eight-pets-clean.md diff --git a/.changeset/eight-pets-clean.md b/.changeset/eight-pets-clean.md new file mode 100644 index 000000000000..819419c8d3b5 --- /dev/null +++ b/.changeset/eight-pets-clean.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/adapter-netlify': patch +--- + +Ensure tmp dir is created diff --git a/packages/adapter-netlify/index.js b/packages/adapter-netlify/index.js index eaee54986bb1..3810dcb1a17d 100644 --- a/packages/adapter-netlify/index.js +++ b/packages/adapter-netlify/index.js @@ -88,6 +88,12 @@ export default function ({ split = false, edge = edgeSetInEnvVar } = {}) { * @param {import('@sveltejs/kit').Builder} params.builder */ async function generate_edge_functions({ builder }) { + const tmp = builder.getBuildDirectory('netlify-tmp'); + builder.rimraf(tmp); + builder.mkdirp(tmp); + + builder.mkdirp('.netlify/edge-functions'); + // Don't match the static directory const pattern = '^/.*$'; @@ -104,11 +110,6 @@ async function generate_edge_functions({ builder }) { ], version: 1 }; - const tmp = builder.getBuildDirectory('netlify-tmp'); - - builder.rimraf(tmp); - - builder.mkdirp('.netlify/edge-functions'); builder.log.minor('Generating Edge Function...'); const relativePath = posix.relative(tmp, builder.getServerDirectory());