Skip to content

Commit e82fe2b

Browse files
authored
ensure _redirects parent exists (#4676)
1 parent 0c3f9a0 commit e82fe2b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/lucky-glasses-sell.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/adapter-netlify': patch
3+
---
4+
5+
Ensure build directory exists before writing \_redirects

packages/adapter-netlify/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { appendFileSync, existsSync, readFileSync, writeFileSync } from 'fs';
2-
import { join, resolve, posix } from 'path';
2+
import { dirname, join, resolve, posix } from 'path';
33
import { fileURLToPath } from 'url';
44
import glob from 'tiny-glob/sync.js';
55
import esbuild from 'esbuild';
@@ -234,6 +234,7 @@ function generate_lambda_functions({ builder, publish, split, esm }) {
234234
if (existsSync('_redirects')) {
235235
builder.copy('_redirects', redirect_file);
236236
}
237+
builder.mkdirp(dirname(redirect_file));
237238
appendFileSync(redirect_file, `\n\n${redirects.join('\n')}`);
238239
}
239240

0 commit comments

Comments
 (0)