dev mode fix

This commit is contained in:
Tarun Kumar Sukhu 2022-02-07 08:53:17 +05:30
parent 4508b13a3c
commit 9aa5195a08
2 changed files with 4 additions and 4 deletions

View File

@ -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 || {}

View File

@ -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`