@@ -291,6 +291,8 @@ async function patchNextModules(
291291export const copyNextDependencies = async ( ctx : PluginContext ) : Promise < void > => {
292292 await tracer . withActiveSpan ( 'copyNextDependencies' , async ( ) => {
293293 const entries = await readdir ( ctx . standaloneDir )
294+ const filter = ctx . constants . IS_LOCAL ? undefined : nodeModulesFilter
295+
294296 const promises : Promise < void > [ ] = entries . map ( async ( entry ) => {
295297 // copy all except the distDir (.next) folder as this is handled in a separate function
296298 // this will include the node_modules folder as well
@@ -299,7 +301,6 @@ export const copyNextDependencies = async (ctx: PluginContext): Promise<void> =>
299301 }
300302 const src = join ( ctx . standaloneDir , entry )
301303 const dest = join ( ctx . serverHandlerDir , entry )
302- const filter = ctx . constants . IS_LOCAL ? undefined : nodeModulesFilter
303304 await cp ( src , dest , {
304305 recursive : true ,
305306 verbatimSymlinks : true ,
@@ -321,7 +322,7 @@ export const copyNextDependencies = async (ctx: PluginContext): Promise<void> =>
321322 // see: https://github.com/vercel/next.js/issues/50072
322323 if ( existsSync ( rootSrcDir ) && ctx . standaloneRootDir !== ctx . standaloneDir ) {
323324 promises . push (
324- cp ( rootSrcDir , rootDestDir , { recursive : true , verbatimSymlinks : true } ) . then ( ( ) =>
325+ cp ( rootSrcDir , rootDestDir , { recursive : true , verbatimSymlinks : true , filter } ) . then ( ( ) =>
325326 recreateNodeModuleSymlinks ( resolve ( 'node_modules' ) , rootDestDir ) ,
326327 ) ,
327328 )
0 commit comments