-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- refactor. Thanks @jordanmaslyn! 🙌
- Loading branch information
Showing
1 changed file
with
25 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,34 @@ | ||
import { withFaust, getWpHostname } from '@faustwp/core'; | ||
import withMarkdoc from '@markdoc/next.js' | ||
import withSearch from './markdoc/search.mjs' | ||
import atlasCacheHandler from './.atlas/atlas-cache-handler.js' | ||
|
||
function experimentalConfig() { | ||
|
||
const experimental = { | ||
scrollRestoration: true, | ||
async function getAtlasCacheHandler() { | ||
if (process.env.ATLAS_CACHE_HANDLER_ENABLED !== "true") { | ||
return {}; | ||
} | ||
|
||
const {default: atlasCacheHandler} = await import('./.atlas/atlas-cache-handler.js'); | ||
|
||
if (process.env.ATLAS_CACHE_HANDLER_ENABLED !== undefined) { | ||
const atlasExperimentalOptions = { ...experimental, ...{ | ||
incrementalCacheHandlerPath: atlasCacheHandler, | ||
isrMemoryCacheSize: 0 | ||
}} | ||
return atlasExperimentalOptions | ||
} | ||
|
||
return experimental | ||
return { | ||
incrementalCacheHandlerPath: atlasCacheHandler, | ||
isrMemoryCacheSize: 0, | ||
}; | ||
} | ||
|
||
const nextConfig = { | ||
reactStrictMode: true, | ||
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'mdx'], | ||
experimental: experimentalConfig(), | ||
trailingSlash: true, | ||
images: { | ||
domains: [getWpHostname()], | ||
}, | ||
const nextConfig = async () => { | ||
return { | ||
reactStrictMode: true, | ||
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'mdx'], | ||
experimental: { | ||
scrollRestoration: true, | ||
...(await getAtlasCacheHandler()) | ||
}, | ||
trailingSlash: true, | ||
images: { | ||
domains: [getWpHostname()], | ||
}, | ||
} | ||
}; | ||
|
||
export default withFaust( withSearch( withMarkdoc({ schemaPath: './src/markdoc' })(nextConfig) ) ); | ||
|
||
|
||
export default withFaust( withSearch( withMarkdoc({ schemaPath: './src/markdoc' })(nextConfig) ) ); |