diff --git a/.changeset/fresh-games-roll.md b/.changeset/fresh-games-roll.md new file mode 100644 index 0000000000..1c7fa02ffa --- /dev/null +++ b/.changeset/fresh-games-roll.md @@ -0,0 +1,5 @@ +--- +'@graphcommerce/next-config': patch +--- + +Added @graphcommerce packages in node_modules to nextjs watch options diff --git a/packagesDev/next-config/dist/withGraphCommerce.js b/packagesDev/next-config/dist/withGraphCommerce.js index fc2ee146b8..4d69fb89b1 100644 --- a/packagesDev/next-config/dist/withGraphCommerce.js +++ b/packagesDev/next-config/dist/withGraphCommerce.js @@ -135,6 +135,10 @@ function withGraphCommerce(nextConfig, cwd) { new RegExp(`^(.+?[\\/]node_modules[\\/])(?!${transpilePackages.join('|')})`), ], }; + config.watchOptions = { + ...(config.watchOptions ?? {}), + ignored: new RegExp(`^((?:[^/]*(?:/|$))*)(.(git|next)|(node_modules[\\/](?!${transpilePackages.join('|')})))(/((?:[^/]*(?:/|$))*)(?:$|/))?`), + }; if (!config.resolve) config.resolve = {}; config.resolve.alias = { diff --git a/packagesDev/next-config/src/withGraphCommerce.ts b/packagesDev/next-config/src/withGraphCommerce.ts index 9f39f17228..596206509f 100644 --- a/packagesDev/next-config/src/withGraphCommerce.ts +++ b/packagesDev/next-config/src/withGraphCommerce.ts @@ -13,18 +13,21 @@ let graphcommerceConfig: GraphCommerceConfig function domains(config: GraphCommerceConfig): DomainLocale[] { return Object.values( - config.storefront.reduce((acc, loc) => { - if (!loc.domain) return acc - - acc[loc.domain] = { - defaultLocale: loc.locale, - locales: [...(acc[loc.domain]?.locales ?? []), loc.locale], - domain: loc.domain, - http: process.env.NODE_ENV === 'development' || undefined, - } as DomainLocale - - return acc - }, {} as Record), + config.storefront.reduce( + (acc, loc) => { + if (!loc.domain) return acc + + acc[loc.domain] = { + defaultLocale: loc.locale, + locales: [...(acc[loc.domain]?.locales ?? []), loc.locale], + domain: loc.domain, + http: process.env.NODE_ENV === 'development' || undefined, + } as DomainLocale + + return acc + }, + {} as Record, + ), ) } @@ -161,6 +164,15 @@ export function withGraphCommerce(nextConfig: NextConfig, cwd: string): NextConf ], } + config.watchOptions = { + ...(config.watchOptions ?? {}), + ignored: new RegExp( + `^((?:[^/]*(?:/|$))*)(.(git|next)|(node_modules[\\/](?!${transpilePackages.join( + '|', + )})))(/((?:[^/]*(?:/|$))*)(?:$|/))?`, + ), + } + if (!config.resolve) config.resolve = {} config.resolve.alias = { ...config.resolve.alias,