Fix React export when static directory doesn't exist yet

This commit is contained in:
Aurora Lahtela 2022-12-06 12:41:50 +02:00
parent 8fadcc3afb
commit d4798f1303

View File

@ -117,6 +117,7 @@ public class ReactExporter extends FileExporter {
private void deleteOldStaticBundleFiles(Path toDirectory) throws IOException { private void deleteOldStaticBundleFiles(Path toDirectory) throws IOException {
Set<Path> filesToDelete; Set<Path> filesToDelete;
Path staticDirectory = toDirectory.resolve("static"); Path staticDirectory = toDirectory.resolve("static");
if (!Files.isDirectory(staticDirectory)) return;
try (Stream<Path> exportedFiles = Files.walk(staticDirectory)) { try (Stream<Path> exportedFiles = Files.walk(staticDirectory)) {
filesToDelete = exportedFiles filesToDelete = exportedFiles
.filter(path -> { .filter(path -> {