diff --git a/packages/commerce/src/config.cjs b/packages/commerce/src/config.cjs index aabc16e0c..d6c3a46fa 100644 --- a/packages/commerce/src/config.cjs +++ b/packages/commerce/src/config.cjs @@ -8,15 +8,15 @@ const importCwd = require('import-cwd') function withCommerceConfig(nextConfig = {}) { const commerce = nextConfig.commerce || {} - const { provider } = commerce + const { provider, modulePath } = commerce if (!provider) { throw new Error( `The commerce provider is missing, please add a valid provider name` ) } - - const commerceNextConfig = importCwd(path.join(provider, 'next.config')) + // Use module path to load the provider configuration + const commerceNextConfig = importCwd(path.join(modulePath, 'next.config.cjs')) const config = merge(nextConfig, commerceNextConfig) config.env = config.env || {} diff --git a/site/commerce-config.js b/site/commerce-config.js index d52797e51..a73ef164a 100644 --- a/site/commerce-config.js +++ b/site/commerce-config.js @@ -78,7 +78,7 @@ function withCommerceConfig(nextConfig = {}) { tsconfigPath, prettier.format(JSON.stringify(tsconfig), { parser: 'json' }) ) - + commerce.modulePath = modulePath; // Save Module Path for Loading Provider const webpack = config.webpack // To improve the DX of using references, we'll switch from `src` to `dist`