@@ -39,10 +39,14 @@ const EXCLUDED_PACKAGES = [
39
39
// This seems to be only in Next 15
40
40
// Some of sharp deps are under the @img scope
41
41
"@img" ,
42
+ "typescript" ,
43
+ "next/dist/compiled/babel" ,
44
+ "next/dist/compiled/babel-packages" ,
45
+ "next/dist/compiled/amphtml-validator" ,
42
46
] ;
43
47
44
- function isExcluded ( srcPath : string ) {
45
- return EXCLUDED_PACKAGES . some ( ( excluded ) =>
48
+ function isExcluded ( srcPath : string ) : string | undefined {
49
+ return EXCLUDED_PACKAGES . find ( ( excluded ) =>
46
50
srcPath . match ( getCrossPlatformPathRegex ( `/node_modules/${ excluded } /` ) ) ,
47
51
) ;
48
52
}
@@ -250,11 +254,17 @@ File ${serverPath} does not exist
250
254
251
255
// Only files that are actually copied
252
256
const tracedFiles : string [ ] = [ ] ;
253
-
257
+ // Packages that are excluded and not copied
258
+ const excludedPackages = new Set < string > ( ) ;
254
259
//Actually copy the files
255
260
filesToCopy . forEach ( ( to , from ) => {
256
- // We don't want to copy excluded packages (i.e sharp)
257
- if ( isExcluded ( from ) ) {
261
+ // We don't want to copy excluded packages (e.g. sharp)
262
+ const excluded = isExcluded ( from ) ;
263
+ if ( excluded ) {
264
+ if ( excluded && ! excludedPackages . has ( excluded ) ) {
265
+ logger . debug ( "Skipping excluded package:" , excluded ) ;
266
+ excludedPackages . add ( excluded ) ;
267
+ }
258
268
return ;
259
269
}
260
270
tracedFiles . push ( to ) ;
0 commit comments