Skip to content

Commit ed90e66

Browse files
committed
chore: Exclude more packages
1 parent 042dfd9 commit ed90e66

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

packages/open-next/src/build/copyTracedFiles.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,14 @@ const EXCLUDED_PACKAGES = [
3939
// This seems to be only in Next 15
4040
// Some of sharp deps are under the @img scope
4141
"@img",
42+
"typescript",
43+
"next/dist/compiled/babel",
44+
"next/dist/compiled/babel-packages",
45+
"next/dist/compiled/amphtml-validator",
4246
];
4347

44-
function isExcluded(srcPath: string) {
45-
return EXCLUDED_PACKAGES.some((excluded) =>
48+
function isExcluded(srcPath: string): string | undefined {
49+
return EXCLUDED_PACKAGES.find((excluded) =>
4650
srcPath.match(getCrossPlatformPathRegex(`/node_modules/${excluded}/`)),
4751
);
4852
}
@@ -250,11 +254,17 @@ File ${serverPath} does not exist
250254

251255
// Only files that are actually copied
252256
const tracedFiles: string[] = [];
253-
257+
// Packages that are excluded and not copied
258+
const excludedPackages = new Set<string>();
254259
//Actually copy the files
255260
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+
}
258268
return;
259269
}
260270
tracedFiles.push(to);

0 commit comments

Comments
 (0)