diff --git a/packages/cli/src/utils/hcms.ts b/packages/cli/src/utils/hcms.ts index 6f5e1821cd..fd30f80674 100644 --- a/packages/cli/src/utils/hcms.ts +++ b/packages/cli/src/utils/hcms.ts @@ -128,12 +128,12 @@ export async function mergeCMSFile(fileName: string, basePath: string) { const plugins = await getPluginsList(basePath) - const pluginPaths = plugins.map((plugin) => - getPackagePath(getPluginName(plugin), 'src', 'cms', fileName) + const pluginCMSFilePaths = plugins.map((plugin) => + getPackagePath(getPluginName(plugin), 'cms', 'faststore', fileName) ) - const customizations = [...pluginPaths, customFilePath].filter((pluginPath) => - existsSync(pluginPath) + const customizations = [...pluginCMSFilePaths, customFilePath].filter( + (pluginCMSFilePath) => existsSync(pluginCMSFilePath) ) // TODO: create a validation when the CMS files exist but don't have a component for them diff --git a/packages/cli/src/utils/plugins.ts b/packages/cli/src/utils/plugins.ts index 9941e4456f..e4b9eca45b 100644 --- a/packages/cli/src/utils/plugins.ts +++ b/packages/cli/src/utils/plugins.ts @@ -59,9 +59,14 @@ const getPluginSrcPath = async (basePath: string, pluginName: string) => { export const getPluginsList = async (basePath: string): Promise => { const { tmpStoreConfigFile } = withBasePath(basePath) - const { plugins = [] } = await import(tmpStoreConfigFile) + try { + const { plugins } = await import(tmpStoreConfigFile) + return plugins + } catch (error) { + logger.error(`Could not load plugins from store config`) + } - return plugins + return [] } const copyPluginsSrc = async (basePath: string, plugins: Plugin[]) => {