mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 15:36:58 +00:00
dev mode fix
This commit is contained in:
parent
4508b13a3c
commit
9aa5195a08
@ -8,15 +8,15 @@ const importCwd = require('import-cwd')
|
|||||||
|
|
||||||
function withCommerceConfig(nextConfig = {}) {
|
function withCommerceConfig(nextConfig = {}) {
|
||||||
const commerce = nextConfig.commerce || {}
|
const commerce = nextConfig.commerce || {}
|
||||||
const { provider } = commerce
|
const { provider, modulePath } = commerce
|
||||||
|
|
||||||
if (!provider) {
|
if (!provider) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`The commerce provider is missing, please add a valid provider name`
|
`The commerce provider is missing, please add a valid provider name`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
// Use module path to load the provider configuration
|
||||||
const commerceNextConfig = importCwd(path.join(provider, 'next.config'))
|
const commerceNextConfig = importCwd(path.join(modulePath, 'next.config.cjs'))
|
||||||
const config = merge(nextConfig, commerceNextConfig)
|
const config = merge(nextConfig, commerceNextConfig)
|
||||||
|
|
||||||
config.env = config.env || {}
|
config.env = config.env || {}
|
||||||
|
@ -78,7 +78,7 @@ function withCommerceConfig(nextConfig = {}) {
|
|||||||
tsconfigPath,
|
tsconfigPath,
|
||||||
prettier.format(JSON.stringify(tsconfig), { parser: 'json' })
|
prettier.format(JSON.stringify(tsconfig), { parser: 'json' })
|
||||||
)
|
)
|
||||||
|
commerce.modulePath = modulePath; // Save Module Path for Loading Provider
|
||||||
const webpack = config.webpack
|
const webpack = config.webpack
|
||||||
|
|
||||||
// To improve the DX of using references, we'll switch from `src` to `dist`
|
// To improve the DX of using references, we'll switch from `src` to `dist`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user