Skip to content

Commit

Permalink
fix: next 10.0.8 changes loadConfig to be async (#105)
Browse files Browse the repository at this point in the history
* fix: 10.0.8 changes loadConfig to be async

* wip: make literally everything async bc loadConfig

* wip: fix i18n bug, got 10.0.6 tests to pass

* wip: NoN tests pass on 10.0.8 but plugin test chdir fixture issue

* Fix bug with Jest

* fix: delete TO-DO

Co-authored-by: ehmicky <ehmicky@gmail.com>
  • Loading branch information
lindsaylevine and ehmicky authored Mar 8, 2021
1 parent 2ca947d commit 040a627
Show file tree
Hide file tree
Showing 51 changed files with 568 additions and 627 deletions.
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

0 comments on commit 040a627

Please sign in to comment.