diff --git a/ghost/core/core/server/lib/lexical.js b/ghost/core/core/server/lib/lexical.js index 13f33df762..45475a4831 100644 --- a/ghost/core/core/server/lib/lexical.js +++ b/ghost/core/core/server/lib/lexical.js @@ -3,12 +3,12 @@ const errors = require('@tryghost/errors'); const urlUtils = require('../../shared/url-utils'); const config = require('../../shared/config'); const storage = require('../adapters/storage'); -const serializePosts = require('../api/endpoints/utils/serializers/output/posts').all; let nodes; let lexicalHtmlRenderer; let urlTransformMap; let postsService; +let serializePosts; function populateNodes() { const {DEFAULT_NODES} = require('@tryghost/kg-default-nodes'); @@ -34,6 +34,9 @@ module.exports = { const getPostServiceInstance = require('../services/posts/posts-service'); postsService = getPostServiceInstance(); } + if (!serializePosts) { + serializePosts = require('../api/endpoints/utils/serializers/output/posts').all; + } const getCollectionPosts = async (collectionSlug, postCount) => { const frame = {