Skip to content

Commit c3f8aca

Browse files
authored
fix: check for public dir (#35)
1 parent ca3361e commit c3f8aca

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const { join } = require('path')
44

5-
const { copy } = require('fs-extra')
5+
const { copy, existsSync } = require('fs-extra')
66

77
const { ODB_FUNCTION_NAME, HANDLER_FUNCTION_NAME } = require('./constants')
88
const { restoreCache, saveCache } = require('./helpers/cache')
@@ -51,9 +51,10 @@ module.exports = {
5151
setIncludedFiles({ netlifyConfig, publish })
5252

5353
await generateFunctions(constants, appDir)
54-
55-
await copy(`${appDir}/public`, `${publish}/`)
56-
54+
const publicDir = join(appDir, 'public')
55+
if (existsSync(publicDir)) {
56+
await copy(publicDir, `${publish}/`)
57+
}
5758
await setupImageFunction({ constants, imageconfig: images, netlifyConfig, basePath })
5859

5960
await generateRedirects({

0 commit comments

Comments
 (0)