Skip to content

Do not copy unnecessary cache file #822

Open
@conico974

Description

@conico974

We should not copy and delete file there

const outputPath = path.join(outputDir, "cache", buildId);
[".next/server/pages", ".next/server/app"]
.map((dir) => path.join(dotNextPath, dir))
.filter(fs.existsSync)
.forEach((dir) => fs.cpSync(dir, outputPath, { recursive: true }));
// Remove non-cache files
const htmlPages = buildHelper.getHtmlPages(dotNextPath);
buildHelper.removeFiles(
outputPath,
({ relativePath }) =>
relativePath.endsWith(".js") ||
relativePath.endsWith(".js.nft.json") ||
(relativePath.endsWith(".html") && htmlPages.has(relativePath)),
);

Ideally, we should also add a revalidate value (from the prerender manifest) here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions