@@ -6,8 +6,10 @@ import { CONSTANTS } from '../../helpers.js';
66import { createBaseConfig } from '../createBaseConfig.js' ;
77import { GraphqlPlugin } from '../plugins/GraphqlPlugin.js' ;
88import { ThemeWatcherPlugin } from '../plugins/ThemeWatcherPlugin.js' ;
9+ import { getEnabledExtensions } from '../../../bin/extension/index.js' ;
910
1011export function createConfigClient ( route , tailwindConfig ) {
12+ const extensions = getEnabledExtensions ( ) ;
1113 const config = createBaseConfig ( false ) ;
1214 config . name = route . id ;
1315
@@ -121,10 +123,28 @@ export function createConfigClient(route, tailwindConfig) {
121123
122124 // Enable source maps
123125 config . devtool = 'eval-cheap-module-source-map' ;
126+
127+ // Configure snapshot management for better caching
128+ // Exclude @evershop /evershop core and extensions in node_modules from managed paths
129+ // This ensures webpack watches for changes in these paths
130+ const nodeModuleExtensions = extensions
131+ . filter ( ( ext ) => ext . path && ext . path . includes ( 'node_modules' ) )
132+ . map ( ( ext ) => {
133+ // Extract package name from path (e.g., @vendor/package or package-name)
134+ const match = ext . path . match (
135+ / n o d e _ m o d u l e s [ \\ / ] ( @ [ ^ / \\ ] + [ \\ / ] [ ^ / \\ ] + | [ ^ / \\ ] + ) /
136+ ) ;
137+ return match ? match [ 1 ] . replace ( / \\ / g, '[\\\\/]' ) : null ;
138+ } )
139+ . filter ( Boolean )
140+ . join ( '|' ) ;
141+
142+ const managedPathsPattern = nodeModuleExtensions
143+ ? `^(.+?[\\\\/]node_modules[\\\\/](?!(@evershop[\\\\/]evershop|${ nodeModuleExtensions } ))(@.+?[\\\\/])?.+?)[\\\\/]`
144+ : `^(.+?[\\\\/]node_modules[\\\\/](?!(@evershop[\\\\/]evershop))(@.+?[\\\\/])?.+?)[\\\\/]` ;
145+
124146 config . snapshot = {
125- managedPaths : [
126- / ^ ( .+ ?[ \\ / ] n o d e _ m o d u l e s [ \\ / ] (? ! ( @ e v e r s h o p [ \\ / ] e v e r s h o p ) ) ( @ .+ ?[ \\ / ] ) ? .+ ?) [ \\ / ] /
127- ]
147+ managedPaths : [ new RegExp ( managedPathsPattern ) ]
128148 } ;
129149
130150 return config ;
0 commit comments