Skip to content

fix: prevent reach-router dep requirement for v2 #557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 23, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
shouldSkipBundlingDatastore,
} from './helpers/config'
import { modifyFiles } from './helpers/files'
import { deleteFunctions, writeFunctions } from './helpers/functions'
import { deleteFunctions } from './helpers/functions'
import { checkZipSize } from './helpers/verification'

const DEFAULT_FUNCTIONS_SRC = 'netlify/functions'
Expand Down Expand Up @@ -69,9 +69,15 @@ The plugin no longer uses this and it should be deleted to avoid conflicts.\n`)
console.log('Creating site data metadata file')
await createMetadataFileAndCopyDatastore(PUBLISH_DIR, cacheDir)
}

await writeFunctions({ constants, netlifyConfig, neededFunctions })

// Gatsby V2 does not have functions so we can skip this step
if (neededFunctions.length !== 0) {
const helperFunctions = await import('./helpers/functions')
await helperFunctions.writeFunctions({
constants,
netlifyConfig,
neededFunctions,
})
}
await modifyConfig({ netlifyConfig, cacheDir, neededFunctions })

await modifyFiles({ netlifyConfig, neededFunctions })
Expand Down