Skip to content
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

fix: next 10.0.8 changes loadConfig to be async #105

Merged
merged 6 commits into from
Mar 8, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion helpers/doesNotNeedPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const doesNotNeedPlugin = async ({ netlifyConfig, packageJson, utils }) => {
return (
isStaticExportProject({ build, scripts }) ||
doesSiteUseNextOnNetlify({ packageJson }) ||
!hasCorrectNextConfig({ nextConfigPath, failBuild: utils.build.failBuild })
!(await hasCorrectNextConfig({ nextConfigPath, failBuild: utils.build.failBuild }))
)
}

Expand Down
4 changes: 2 additions & 2 deletions helpers/hasCorrectNextConfig.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require('path')

// Checks if site has the correct next.cofig.js
const hasCorrectNextConfig = ({ nextConfigPath, failBuild }) => {
const hasCorrectNextConfig = async ({ nextConfigPath, failBuild }) => {
// In the plugin's case, no config is valid because we'll make it ourselves
if (nextConfigPath === undefined) return true

Expand All @@ -14,7 +14,7 @@ const hasCorrectNextConfig = ({ nextConfigPath, failBuild }) => {
const acceptableTargets = ['serverless', 'experimental-serverless-trace']
let nextConfig
try {
nextConfig = loadConfig(PHASE_PRODUCTION_BUILD, path.resolve('.'))
nextConfig = await loadConfig(PHASE_PRODUCTION_BUILD, path.resolve('.'))
} catch (error) {
return failBuild('Error loading your next.config.js.', { error })
}
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = {

await makeDir(PUBLISH_DIR)

nextOnNetlify({ functionsDir: FUNCTIONS_SRC, publishDir: PUBLISH_DIR })
await nextOnNetlify({ functionsDir: FUNCTIONS_SRC, publishDir: PUBLISH_DIR })
},
}

Expand Down
Loading