Skip to content

Commit

Permalink
- refactor. Thanks @jordanmaslyn! 🙌
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonbahl committed Jan 13, 2024
1 parent 34691b5 commit 13c1ea1
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions next.config.mjs
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) ) );

0 comments on commit 13c1ea1

Please sign in to comment.