Skip to content

feat: add css files to server bundle for optimizeCss feature to work #904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/open-next/src/build/copyTracedFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import url from "node:url";

import {
copyFileSync,
cpSync,
existsSync,
mkdirSync,
readFileSync,
Expand Down Expand Up @@ -360,6 +361,14 @@ File ${serverPath} does not exist
.forEach((file) => copyStaticFile(`server/${file}`));
}

// Copy .next/static/css from standalone to output dir
// needed for optimizeCss feature to work
cpSync(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should only copy this if optimizeCss is true. We don't want to add unnecessary files to the bundle

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got you, I will make changes then

path.join(standaloneNextDir, "static", "css"),
path.join(outputNextDir, "static", "css"),
{ recursive: true },
);

logger.debug("copyTracedFiles:", Date.now() - tsStart, "ms");

return {
Expand Down
Loading